[cairo] [PATCH] mask compositor: Set a check_composite method

Uli Schlachter psychon at znc.in
Fri Mar 14 06:26:58 PDT 2014

Commit 503b6b9e2ea6 added a check_composite method to the mask compositor, but
only added it to one of the existing implementations. This commit fixes that.

In cairo-image-compositor.c, there is already a check_composite method which
just returns success for the traps compositor. This commit makes the mask
compositor use that one.

I don't want to say much about cairo-image-mask-compositor.c except that I
wondered why this file and the file above both define a non-static function
called _cairo_image_mask_compositor_get(). In my opinion, that file should just
be deleted, since it confuses e.g. ctags, but I'll let someone else clean this

Fixes 493 crashes in the test suite for the test-mask target.

Signed-off-by: Uli Schlachter <psychon at znc.in>
 src/cairo-image-compositor.c      | 2 +-
 src/cairo-image-mask-compositor.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/cairo-image-compositor.c b/src/cairo-image-compositor.c
index 03468a6..51ffc34 100644
--- a/src/cairo-image-compositor.c
+++ b/src/cairo-image-compositor.c
@@ -1257,7 +1257,7 @@ _cairo_image_mask_compositor_get (void)
 	compositor.draw_image_boxes = draw_image_boxes;
 	compositor.fill_rectangles = fill_rectangles;
 	compositor.fill_boxes = fill_boxes;
-	//compositor.check_composite = check_composite;
+	compositor.check_composite = check_composite;
 	compositor.composite = composite;
 	//compositor.lerp = lerp;
 	//compositor.check_composite_boxes = check_composite_boxes;
diff --git a/src/cairo-image-mask-compositor.c b/src/cairo-image-mask-compositor.c
index 33fd6dd..bb990dd 100644
--- a/src/cairo-image-mask-compositor.c
+++ b/src/cairo-image-mask-compositor.c
@@ -48,6 +48,8 @@
 #include "cairo-compositor-private.h"
 #include "cairo-region-private.h"
+#error This file isn't included in any Makefile
 static cairo_int_status_t
 acquire (void *abstract_dst)
@@ -398,6 +400,7 @@ _cairo_image_mask_compositor_get (void)
 	compositor.draw_image = draw_image;
 	compositor.fill_rectangles = fill_rectangles;
 	compositor.fill_boxes = fill_boxes;
+#error check_composite must never be NULL, because it gets called without a NULL pointer check
 	//compositor.check_composite = check_composite;
 	compositor.composite = composite;
 	//compositor.check_composite_boxes = check_composite_boxes;

More information about the cairo mailing list