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

Yuanhan Liu <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
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 <[email protected]>
---
 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

--
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.