summaryrefslogtreecommitdiff
path: root/pixman/pixman-region.c
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <sandmann@redhat.com>2009-07-21 07:01:10 -0400
committerSøren Sandmann Pedersen <sandmann@redhat.com>2009-07-21 07:01:10 -0400
commit7c56911e3b5b97b26dceff9b68d9fed32693d57b (patch)
tree03ae7fa3194846618890afa3048f628ffce09ee3 /pixman/pixman-region.c
parentf9660ce29ed072c6cbaec711c5d18b9f0ba113ae (diff)
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.
Diffstat (limited to 'pixman/pixman-region.c')
-rw-r--r--pixman/pixman-region.c40
1 files changed, 38 insertions, 2 deletions
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;