[cairo-commit] src/cairo-paginated-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Jul 27 06:05:13 PDT 2009


 src/cairo-paginated-surface.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

New commits:
commit 9f6a0f5668601c74886378d6cdb9588621d30e6d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jul 27 14:01:32 2009 +0100

    [paginated] Propagate error return during finish.
    
    In bed2701, I removed the explicit finish of the paginated's target
    surface, since as a wrapper it did not explicitly own the surface and so
    should not be calling finish(). However, we do need to propagate errors
    from the backing surface, such as PDF, which will only be detected during
    the implicit finish in the final destroy. So check to see it we hold the
    last reference to the target (and so our destroy will trigger the implicit
    finish) and call the finish explicitly and check the error status
    afterwards.

diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index 23443a5..34c4676 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -159,6 +159,16 @@ _cairo_paginated_surface_finish (void *abstract_surface)
 	status = cairo_surface_status (abstract_surface);
     }
 
+     /* XXX We want to propagate any errors from destroy(), but those are not
+      * returned via the api. So we need to explicitly finish the target,
+      * 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) {
+	cairo_surface_finish (surface->target);
+	if (status == CAIRO_STATUS_SUCCESS)
+	    status = cairo_surface_status (surface->target);
+    }
     cairo_surface_destroy (surface->target);
 
     cairo_surface_finish (surface->meta);


More information about the cairo-commit mailing list