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

Chris Wilson chris at chris-wilson.co.uk
Thu Jan 31 06:27:15 PST 2013

On Wed, Jan 30, 2013 at 08:13:19PM +0000, Henry (Yu) Song - SISA wrote:
> Please discard previous submitted patch, this patch is better.  Please review
> From 3ec142e09018dc6a58f16c325fe77091e6d086c3 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 1/2] surface: increase reference count for parent of cloned
>  image
> If an image surface is created as result of
> _cairo_image_surface_clone_subimage() during either
> private call _cairo_surface_map_to_image() or
> public call cairo_surface_map_to_image(),
> we need to increase reference count of its parent to account for
> parent's reference count descrease when image is destroyed

Hmm, I'd like for the image surface from map-to-image to always hold a
reference on the parent surface - that would trivially prevent one easy
user error and would be prudent in cases were the resultant image
surface is indeed a direct pointer into its parent's resources.

Failing that, I settled for a slightly smaller patch to fixup the
referencing counting in _cairo_image_surface_clone_subimage().


Chris Wilson, Intel Open Source Technology Centre

More information about the cairo mailing list