[patch] surface: set image->parent = NULL

"Henry (Yu) Song - SISA" <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <3955FA337689574EB32F94B12A7E6E9E434AD7FA@sisaex01sj>
From 5d9a4aeaccc6497105ae4ad1347bc08165cff92f Mon Sep 17 00:00:00 2001
From: Henry Song <[email protected]>
Date: Wed, 30 Jan 2013 08:29:06 -0800
Subject: [PATCH] surface: for image->parent = NULL in
 cairo_surface_map_to_image()

This ensures parent's reference count will get decreased during
cairo_surface_unmap_image()
---
 src/cairo-surface.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index ffffef8..2f8dca2 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -793,6 +793,9 @@ cairo_surface_map_to_image (cairo_surface_t  *surface,
 	image = _cairo_image_surface_clone_subimage (surface, extents);
     }
 
+    /* unset image->parent to avoid unbalanced reference count */
+    image->parent = NULL;
+
     return &image->base;
 }
 
-- 
1.7.9.5
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.