[cairo] [PATCH] gl: use _cairo_gl_operand_copy to fix unblanced reference count

Yuanhan Liu yuanhan.liu at linux.intel.com
Wed May 30 00:13:46 PDT 2012


Use _cairo_gl_operand_copy to do the operand copy instead of by
something like *operand = surface->operand.

This would fix a crash introduced by operator-source test case, which
forgot to do reference while copying operand but did dereference while
destroying surface at combine_clip_as_traps().

Signed-off-by: Yuanhan Liu <yuanhan.liu at linux.intel.com>
---
 src/cairo-gl-operand.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/cairo-gl-operand.c b/src/cairo-gl-operand.c
index fe1c0af..53b5dc3 100644
--- a/src/cairo-gl-operand.c
+++ b/src/cairo-gl-operand.c
@@ -228,7 +228,7 @@ _cairo_gl_subsurface_operand_init (cairo_gl_operand_t *operand,
      * (unnormalized src -> unnormalized src) to
      * (unnormalized dst -> unnormalized src)
      */
-    *operand = surface->operand;
+    _cairo_gl_operand_copy(operand, &surface->operand);
 
     attributes = &operand->texture.attributes;
     attributes->matrix = src->base.matrix;
@@ -297,7 +297,7 @@ _cairo_gl_surface_operand_init (cairo_gl_operand_t *operand,
     if (unlikely (status))
 	return status;
 
-    *operand = surface->operand;
+    _cairo_gl_operand_copy(operand, &surface->operand);
 
     attributes = &operand->texture.attributes;
     cairo_matrix_multiply (&attributes->matrix,
@@ -378,7 +378,7 @@ _cairo_gl_pattern_texture_setup (cairo_gl_operand_t *operand,
     if (unlikely (status))
 	goto fail;
 
-    *operand = surface->operand;
+    _cairo_gl_operand_copy(operand, &surface->operand);
     operand->texture.owns_surface = surface;
     operand->texture.attributes.matrix.x0 -= extents->x * operand->texture.attributes.matrix.xx;
     operand->texture.attributes.matrix.y0 -= extents->y * operand->texture.attributes.matrix.yy;
-- 
1.7.7.6



More information about the cairo mailing list