[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.
This commit is contained in:
Chris Wilson 2008-04-16 17:24:43 +01:00
parent a2c4fd0572
commit ea6dbfd36f

View file

@ -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);
}