summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-01-31 14:19:53 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-01-31 14:19:53 +0000
commit22b7fae0368ba6cff23b2ebdf58bd7d1bfdfbd6f (patch)
treeae395289398d1d3fa80380e4b18baabf92627539
parentec58fde294afd52c89fa5ed21ba2611edfdbd550 (diff)
image: Add a reference for the clone's parent image
We use the parent as a flag during map-to-image/umap-image that the resultant image came from a fallback rather than as direct call to the backend's map_to_image(). Whilst we use it as a simple flag, we need to make sure the parent surface obeys the reference counting semantics and is consistent for all callers. Unlike other users of the parent pointer, there is no resource sharing between the two surfaces. Reported-by: Henry Song <henry.song@samsung.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/cairo-image-surface.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 3fe6e433..20a1c03e 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -1240,7 +1240,14 @@ _cairo_image_surface_clone_subimage (cairo_surface_t *surface,
if (unlikely (status))
goto error;
- _cairo_image_surface_set_parent (to_image_surface (image), surface);
+ /* We use the parent as a flag during map-to-image/umap-image that the
+ * resultant image came from a fallback rather than as direct call
+ * to the backend's map_to_image(). Whilst we use it as a simple flag,
+ * we need to make sure the parent surface obeys the reference counting
+ * semantics and is consistent for all callers.
+ */
+ _cairo_image_surface_set_parent (to_image_surface (image),
+ cairo_surface_reference (surface));
return to_image_surface (image);