[cairo] [PATCH] Fix _cairo_region_get_boxes usage

Jeff Muizelaar jeff at infidigm.net
Fri Feb 13 12:09:06 PST 2009


The attached patch fixes some issues with callers of
_cairo_region_get_boxes. The new api seems a little bit difficult to
use and I'm wondering if we can fix it at all? Though I don't really have any
ideas or know if it's worth it. Thoughts?

-------------- next part --------------
commit c312af6f7128f2d105d8ddba8563870f45858a96
Author: Jeff Muizelaar <jmuizelaar at mozilla.com>
Date:   Fri Feb 13 13:42:09 2009 -0500

    Fix _cairo_region_get_boxes usage
    Commit f15b1f26becf28457e9ccf8903257a0dec25d547 broke the win32 backend and
    likely others. Previously _cairo_region_get_boxes would NULL the boxes pointer
    if there were no boxes and would relying on _cairo_region_boxes_fini calling on

diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index 5d4e08f..b76c521 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -381,7 +381,7 @@ _paint_page (cairo_paginated_surface_t *surface)
     if (has_finegrained_fallback) {
         cairo_region_t *region;
-        cairo_box_int_t *boxes;
+        cairo_box_int_t *boxes = NULL;
         int num_boxes, i;
 	surface->backend->set_paginated_mode (surface->target,
diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index 03a8f61..e6b2e26 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -1461,7 +1461,7 @@ _cairo_win32_surface_set_clip_region (void           *abstract_surface,
     /* Then combine any new region with it */
     if (region) {
 	cairo_rectangle_int_t extents;
-	cairo_box_int_t *boxes;
+	cairo_box_int_t *boxes = NULL;
 	int num_boxes;
 	RGNDATA *data;
 	size_t data_size;
diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index 2ae7dcf..88bdc4f 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -1555,7 +1555,7 @@ _cairo_xcb_surface_set_clip_region (void           *abstract_surface,
 	    xcb_render_change_picture (surface->dpy, surface->dst_picture,
     } else {
-	cairo_box_int_t *boxes;
+	cairo_box_int_t *boxes = NULL;
 	cairo_status_t status;
 	xcb_rectangle_t *rects = NULL;
 	int n_boxes, i;

More information about the cairo mailing list