diff options
author | Uli Schlachter <psychon@znc.in> | 2020-07-20 18:33:46 +0200 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2020-07-20 18:33:46 +0200 |
commit | b55e491d67e95d7e6ef33f18a239eb6a9a49b7a2 (patch) | |
tree | 6c3a3d96846767743cc906c623765a35228444fb | |
parent | 4777f9cd5f67dcab6e750092630aaace8607c4b5 (diff) | |
parent | 61cd11a39095cb51b9e87beba10905e895567151 (diff) | |
download | cairo-b55e491d67e95d7e6ef33f18a239eb6a9a49b7a2.tar.gz |
Merge branch 'invalid-free-crash' of gitlab.freedesktop.org:psychon/cairo
-rw-r--r-- | src/cairo-clip-inline.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/cairo-clip-inline.h b/src/cairo-clip-inline.h index a9f232692..d52afd313 100644 --- a/src/cairo-clip-inline.h +++ b/src/cairo-clip-inline.h @@ -68,7 +68,14 @@ _cairo_clip_copy_intersect_clip (const cairo_clip_t *clip, static inline void _cairo_clip_steal_boxes (cairo_clip_t *clip, cairo_boxes_t *boxes) { - _cairo_boxes_init_for_array (boxes, clip->boxes, clip->num_boxes); + cairo_box_t *array = clip->boxes; + + if (array == &clip->embedded_box) { + assert (clip->num_boxes == 1); + boxes->boxes_embedded[0] = clip->embedded_box; + array = &boxes->boxes_embedded[0]; + } + _cairo_boxes_init_for_array (boxes, array, clip->num_boxes); clip->boxes = NULL; clip->num_boxes = 0; } @@ -76,7 +83,13 @@ _cairo_clip_steal_boxes (cairo_clip_t *clip, cairo_boxes_t *boxes) static inline void _cairo_clip_unsteal_boxes (cairo_clip_t *clip, cairo_boxes_t *boxes) { - clip->boxes = boxes->chunks.base; + if (boxes->chunks.base == &boxes->boxes_embedded[0]) { + assert(boxes->num_boxes == 1); + clip->embedded_box = *boxes->chunks.base; + clip->boxes = &clip->embedded_box; + } else { + clip->boxes = boxes->chunks.base; + } clip->num_boxes = boxes->num_boxes; } |