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

Henry (Yu) Song - SISA hsong at sisa.samsung.com
Wed Jan 30 08:31:23 PST 2013


>From 5d9a4aeaccc6497105ae4ad1347bc08165cff92f Mon Sep 17 00:00:00 2001
From: Henry Song <henry.song at samsung.com>
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


More information about the cairo mailing list