diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-05-03 19:20:42 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-05-03 19:20:42 +0100 |
commit | c93e6f014d9678b1aea34fd7a30a1fc2f51c6347 (patch) | |
tree | 1de5f809b79a84c10466ce814fa92143b161606f /src/cairo-paginated-surface.c | |
parent | 8e9fd9c01732c3102c27c7dee50f6e494ba7cdd8 (diff) | |
download | cairo-c93e6f014d9678b1aea34fd7a30a1fc2f51c6347.tar.gz |
paginated: propagate malloc failures more cleanly.
Diffstat (limited to 'src/cairo-paginated-surface.c')
-rw-r--r-- | src/cairo-paginated-surface.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c index 064cd1e62..98260b80b 100644 --- a/src/cairo-paginated-surface.c +++ b/src/cairo-paginated-surface.c @@ -160,8 +160,7 @@ _cairo_paginated_surface_finish (void *abstract_surface) /* Bypass some of the sanity checking in cairo-surface.c, as we * know that the surface is finished... */ - if (surface->base.backend->show_page != NULL) - status = surface->base.backend->show_page (&surface->base); + status = _cairo_paginated_surface_show_page (surface); } /* XXX We want to propagate any errors from destroy(), but those are not @@ -169,11 +168,10 @@ _cairo_paginated_surface_finish (void *abstract_surface) * and check the status afterwards. However, we can only call finish() * on the target, if we own it. */ - if (CAIRO_REFERENCE_COUNT_GET_VALUE (&surface->target->ref_count) == 1) { + if (CAIRO_REFERENCE_COUNT_GET_VALUE (&surface->target->ref_count) == 1) cairo_surface_finish (surface->target); - if (status == CAIRO_STATUS_SUCCESS) - status = cairo_surface_status (surface->target); - } + if (status == CAIRO_STATUS_SUCCESS) + status = cairo_surface_status (surface->target); cairo_surface_destroy (surface->target); cairo_surface_finish (surface->recording_surface); @@ -477,15 +475,17 @@ _cairo_paginated_surface_show_page (void *abstract_surface) if (unlikely (status)) return status; - cairo_surface_destroy (surface->recording_surface); + if (! surface->base.finished) { + cairo_surface_destroy (surface->recording_surface); - surface->recording_surface = _create_recording_surface_for_target (surface->target, - surface->content); - status = surface->recording_surface->status; - if (unlikely (status)) - return status; + surface->recording_surface = _create_recording_surface_for_target (surface->target, + surface->content); + status = surface->recording_surface->status; + if (unlikely (status)) + return status; - surface->page_num++; + surface->page_num++; + } return CAIRO_STATUS_SUCCESS; } |