summaryrefslogtreecommitdiff
path: root/src/cairo-image-surface.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-02-15 18:25:35 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-02-15 18:29:26 +0000
commitdf608e0fab542562eb00b4f3c84735946289226a (patch)
treed0ffdc13e3c9faff019a5240b47398e0d1ca605e /src/cairo-image-surface.c
parentdfb8b131f54752462b7888fe6401b239aab89ff8 (diff)
downloadcairo-df608e0fab542562eb00b4f3c84735946289226a.tar.gz
win32: Fix lifetime tracking of create_similar_image()
As we return the child image to the user and so perform the reference tracking on it and not the parent win32 display surface, we need to add a call to destroy the parent from the image surface. This of course complicates the normal scenario of destroying the parent first, and so in that case we need to unhook the image->parent before freeing the surface->image. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-image-surface.c')
-rw-r--r--src/cairo-image-surface.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 66f024c56..982bf45d0 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -813,6 +813,11 @@ _cairo_image_surface_finish (void *abstract_surface)
surface->data = NULL;
}
+ if (surface->parent) {
+ cairo_surface_destroy (surface->parent);
+ surface->parent = NULL;
+ }
+
return CAIRO_STATUS_SUCCESS;
}