spans-compositor: Only destroy the clip if we made the copy

The extents->clip may be replaced elsewhere and so we cannot assume that
simply because it changed from the stashed value, that it was us that
made that copy. So becareful to only free our copy.

Fixes a double-free of a clip after a complex fallback operation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-03-13 11:16:39 +00:00
parent 94a9e06a93
commit d67f02e23e

View file

@ -984,7 +984,7 @@ _cairo_spans_compositor_stroke (const cairo_compositor_t *_compositor,
status = clip_and_composite_polygon (compositor, extents, &polygon,
fill_rule, antialias);
if (extents->clip != saved_clip) {
if (extents->is_bounded) {
_cairo_clip_destroy (extents->clip);
extents->clip = saved_clip;
}
@ -1056,7 +1056,7 @@ _cairo_spans_compositor_fill (const cairo_compositor_t *_compositor,
status = clip_and_composite_polygon (compositor, extents, &polygon,
fill_rule, antialias);
if (extents->clip != saved_clip) {
if (extents->is_bounded) {
_cairo_clip_destroy (extents->clip);
extents->clip = saved_clip;
}