summaryrefslogtreecommitdiff
path: root/src/cairo-gl-operand.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-10-08 13:54:28 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-10-09 19:54:15 +0100
commit34f507a919b0709caa2c0be30e43719356293dd1 (patch)
tree266d33b53e9b1e52677b9b8b3cb2d6d7cf7853f1 /src/cairo-gl-operand.c
parenta6c27b500ba8f910ff2a731eb6989c96e8977339 (diff)
gl: Need to increment reference count when copying operands
Or else watch everything die with use-after-free of the cached gradients. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-gl-operand.c')
-rw-r--r--src/cairo-gl-operand.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/cairo-gl-operand.c b/src/cairo-gl-operand.c
index 86a96df5..f0f76563 100644
--- a/src/cairo-gl-operand.c
+++ b/src/cairo-gl-operand.c
@@ -313,6 +313,30 @@ _cairo_gl_gradient_operand_init (cairo_gl_operand_t *operand,
}
void
+_cairo_gl_operand_copy (cairo_gl_operand_t *dst,
+ const cairo_gl_operand_t *src)
+{
+ *dst = *src;
+ switch (dst->type) {
+ case CAIRO_GL_OPERAND_CONSTANT:
+ break;
+ case CAIRO_GL_OPERAND_LINEAR_GRADIENT:
+ case CAIRO_GL_OPERAND_RADIAL_GRADIENT_A0:
+ case CAIRO_GL_OPERAND_RADIAL_GRADIENT_NONE:
+ case CAIRO_GL_OPERAND_RADIAL_GRADIENT_EXT:
+ _cairo_gl_gradient_reference (dst->gradient.gradient);
+ break;
+ case CAIRO_GL_OPERAND_TEXTURE:
+ break;
+ default:
+ case CAIRO_GL_OPERAND_COUNT:
+ ASSERT_NOT_REACHED;
+ case CAIRO_GL_OPERAND_NONE:
+ break;
+ }
+}
+
+void
_cairo_gl_operand_destroy (cairo_gl_operand_t *operand)
{
switch (operand->type) {