From ea6dbfd36f2182fda16cb82bca92007e0f7b8d77 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 16 Apr 2008 17:24:43 +0100 Subject: [PATCH] [cairo-meta-surface] Save and restore the original clip. When replaying the meta-surface to the target, we apply a stack-based clip to the surface. However, we did not remove this clip from the surface and so a pointer into our stack existed beyond the scope of function. Saving the original clip pointer and restoring it before leaving the function resolves the issue and appears to fix https://bugzilla.mozilla.org/show_bug.cgi?id=429071. --- src/cairo-meta-surface.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c index 441a7d65b..61c9b5d3e 100644 --- a/src/cairo-meta-surface.c +++ b/src/cairo-meta-surface.c @@ -658,8 +658,8 @@ _cairo_meta_surface_replay_internal (cairo_surface_t *surface, cairo_meta_surface_t *meta; cairo_command_t *command, **elements; int i, num_elements; - cairo_int_status_t status; - cairo_clip_t clip; + cairo_int_status_t status, status2; + cairo_clip_t clip, *old_clip; cairo_bool_t has_device_transform = _cairo_surface_has_device_transform (target); cairo_matrix_t *device_transform = &target->device_transform; cairo_path_fixed_t path_copy, *dev_path; @@ -674,6 +674,7 @@ _cairo_meta_surface_replay_internal (cairo_surface_t *surface, status = CAIRO_STATUS_SUCCESS; _cairo_clip_init (&clip, target); + old_clip = _cairo_surface_get_clip (target); num_elements = meta->commands.num_elements; elements = _cairo_array_index (&meta->commands, 0); @@ -867,6 +868,9 @@ _cairo_meta_surface_replay_internal (cairo_surface_t *surface, } _cairo_clip_reset (&clip); + status2 = _cairo_surface_set_clip (target, old_clip); + if (status == CAIRO_STATUS_SUCCESS) + status = status2; return _cairo_surface_set_error (surface, status); }