summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hergert <chergert@redhat.com>2019-07-26 11:03:27 -0700
committerChristian Hergert <chergert@redhat.com>2019-07-26 11:03:27 -0700
commitbff61a1ef14c322c631cd14881f666574ba09ba1 (patch)
tree904e4247e84d3a2a44b3ec65b4f48bf689aee28a
parente89e18256597ee86f55c37d2593e8ba0553cbe9a (diff)
downloadgtk+-wip/chergert/fix-transform-ref.tar.gz
gskglrenderops: ref transform before releasing previous transformwip/chergert/fix-transform-ref
Transforms may reference other transforms, so it is important to ref the incoming transform before releasing any previous one. Otherwise, we risk freeing the transform we wish to ref.
-rw-r--r--gsk/gl/gskglrenderops.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gsk/gl/gskglrenderops.c b/gsk/gl/gskglrenderops.c
index 7c02442d08..e7fa773889 100644
--- a/gsk/gl/gskglrenderops.c
+++ b/gsk/gl/gskglrenderops.c
@@ -233,11 +233,14 @@ ops_set_program (RenderOpBuilder *builder,
if (program_state->modelview == NULL ||
!gsk_transform_equal (builder->current_modelview, program_state->modelview))
{
+ GskTransform *freeme;
+
op.op = OP_CHANGE_MODELVIEW;
gsk_transform_to_matrix (builder->current_modelview, &op.modelview);
g_array_append_val (builder->render_ops, op);
- gsk_transform_unref (program_state->modelview);
+ freeme = program_state->modelview;
program_state->modelview = gsk_transform_ref (builder->current_modelview);
+ gsk_transform_unref (freeme);
}
if (rect_equal (&empty_rect, &program_state->viewport) ||