Skip to content

Commit 31d0ddb

Browse files
committed
Make a copy of the region since pixman is currently taking ownership of it (ugh). Thanks to Vladimir Vukicevic <[email protected]> and Peter Dennis Bartok <[email protected]>.
1 parent adabb18 commit 31d0ddb

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

AUTHORS

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Olivier Andrieu <[email protected]> PNG backend
2+
Peter Dennis Bartok <[email protected]> Bug fix for clipping
23
Dave Beckett <[email protected]> Track rename of libpixman, build fixes
34
Andrew Chant <[email protected]> Adding const where needed
45
John Ellson <[email protected]> First font/glyph extents functions
@@ -13,6 +14,7 @@ David Reveman <[email protected]> New pattern API, OpenGL backend
1314
Jamey Sharp <[email protected]> Surface/font backend virtualization, XCB backend
1415
Bill Spitzak <[email protected]> Build fix to find Xrender.h without xrender.pc
1516
Sasha Vasko <[email protected]> Build fix to compile without xlib backend
17+
Vladimir Vukicevic <[email protected]> Bug fix for clipping
1618
Carl Worth <[email protected]> Original library, support for paths, images
1719
Richard D. Worth <[email protected]> Build fixes for cygwin
1820

ChangeLog

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
2004-08-14 Carl Worth <[email protected]>
22

3+
* src/cairo_image_surface.c
4+
(_cairo_image_surface_set_clip_region): Make a copy of the region
5+
since pixman is currently taking ownership of it (ugh). Thanks to
6+
Vladimir Vukicevic <[email protected]> and Peter Dennis Bartok
7+
8+
39
* autogen.sh (LANG): Explicitly set LANG=C to fix the awk
410
string->number conversion for user with locales that don't match
511
ASCII digit conventions.

src/cairo-image-surface.c

+14-1
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,20 @@ cairo_int_status_t
455455
_cairo_image_surface_set_clip_region (cairo_image_surface_t *surface,
456456
pixman_region16_t *region)
457457
{
458-
pixman_image_set_clip_region (surface->pixman_image, region);
458+
if (region) {
459+
pixman_region16_t *rcopy;
460+
461+
rcopy = pixman_region_create();
462+
/* pixman_image_set_clip_region expects to take ownership of the
463+
* passed-in region, so we create a copy to give it. */
464+
/* XXX: I think that's probably a bug in pixman. But its
465+
* memory management issues need auditing anyway, so a
466+
* workaround like this is fine for now. */
467+
pixman_region_copy (rcopy, region);
468+
pixman_image_set_clip_region (surface->pixman_image, rcopy);
469+
} else {
470+
pixman_image_set_clip_region (surface->pixman_image, region);
471+
}
459472

460473
return CAIRO_STATUS_SUCCESS;
461474
}

src/cairo_image_surface.c

+14-1
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,20 @@ cairo_int_status_t
455455
_cairo_image_surface_set_clip_region (cairo_image_surface_t *surface,
456456
pixman_region16_t *region)
457457
{
458-
pixman_image_set_clip_region (surface->pixman_image, region);
458+
if (region) {
459+
pixman_region16_t *rcopy;
460+
461+
rcopy = pixman_region_create();
462+
/* pixman_image_set_clip_region expects to take ownership of the
463+
* passed-in region, so we create a copy to give it. */
464+
/* XXX: I think that's probably a bug in pixman. But its
465+
* memory management issues need auditing anyway, so a
466+
* workaround like this is fine for now. */
467+
pixman_region_copy (rcopy, region);
468+
pixman_image_set_clip_region (surface->pixman_image, rcopy);
469+
} else {
470+
pixman_image_set_clip_region (surface->pixman_image, region);
471+
}
459472

460473
return CAIRO_STATUS_SUCCESS;
461474
}

0 commit comments

Comments
 (0)