pixman: Branch 'master'

Søren Sandmann Pedersen sandmann at kemper.freedesktop.org
Tue Jul 21 04:07:20 PDT 2009


 pixman/pixman-region.c |   40 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 38 insertions(+), 2 deletions(-)

New commits:
commit 7c56911e3b5b97b26dceff9b68d9fed32693d57b
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Tue Jul 21 07:01:10 2009 -0400

    Don't assert when malformed regions are detected.
    
    Instead print a message to stderr so that it will end up in the X log
    file.

diff --git a/pixman/pixman-region.c b/pixman/pixman-region.c
index 7820b94..387dbba 100644
--- a/pixman/pixman-region.c
+++ b/pixman/pixman-region.c
@@ -64,7 +64,43 @@
 #define PIXREGION_END(reg) PIXREGION_BOX (reg, (reg)->data->numRects - 1)
 
 #define GOOD_RECT(rect) ((rect)->x1 < (rect)->x2 && (rect)->y1 < (rect)->y2)
-#define GOOD(reg) assert (PREFIX (_selfcheck) (reg))
+
+#define PIXMAN_REGION_LOG_FAILURES
+
+#if defined PIXMAN_REGION_DEBUG
+
+#    define GOOD(reg) assert (PREFIX (_selfcheck) (reg))
+
+#elif defined PIXMAN_REGION_LOG_FAILURES
+
+static void
+log_region_error (void)
+{
+    static int n_messages = 0;
+
+    if (n_messages < 50)
+    {
+	fprintf (stderr,
+		 "*** BUG ***\n"
+		 "Malformed region detected\n"
+		 "Set a breakpoint on 'log_region_error' to debug\n\n");
+
+	n_messages++;
+    }
+}
+
+#define GOOD(reg)							\
+    do									\
+    {									\
+	if (!PREFIX (_selfcheck (reg)))					\
+	    log_region_error ();					\
+    } while (0)
+
+#else
+
+#define GOOD(reg)
+
+#endif
 
 static const box_type_t PREFIX (_empty_box_) = { 0, 0, 0, 0 };
 static const region_data_type_t PREFIX (_empty_data_) = { 0, 0 };
@@ -467,7 +503,7 @@ PREFIX (_copy) (region_type_t *dst, region_type_t *src)
 {
     GOOD (dst);
     GOOD (src);
-    
+
     if (dst == src)
 	return TRUE;
     


More information about the xorg-commit mailing list