diff --git a/fb/fb.h b/fb/fb.h index ef7942f2f..ce0729c5a 100644 --- a/fb/fb.h +++ b/fb/fb.h @@ -133,10 +133,11 @@ typedef CARD32 FbStip; typedef int FbStride; +int fb_null_pointer(char *file, unsigned int line); + #define CHECK_NULL(ptr) \ if ((ptr) == NULL) {\ - ErrorF("%s:%d: null pointer\n", __FILE__, __LINE__); \ - return; \ + if (fb_null_pointer(__FILE__, __LINE__)) return; \ } #ifdef FB_DEBUG diff --git a/fb/fbpixmap.c b/fb/fbpixmap.c index f79f7010d..a5545848e 100644 --- a/fb/fbpixmap.c +++ b/fb/fbpixmap.c @@ -318,6 +318,15 @@ fbPixmapToRegion(PixmapPtr pPix) return(pReg); } +int fb_null_pointer(char *file, unsigned int line) { + ErrorF("%s:%u: null pointer (break on fb_null_pointer to debug)\n", file, line); +#ifdef FB_DEBUG + return 0; // ignore error, die horrible death +#else + return 1; // harmlessly return to caller, hope we don't crash later +#endif +} + #ifdef FB_DEBUG #ifndef WIN32 @@ -357,6 +366,9 @@ fbValidateDrawable (DrawablePtr pDrawable) if (pDrawable->type != DRAWABLE_PIXMAP) pDrawable = (DrawablePtr) fbGetWindowPixmap(pDrawable); fbGetStipDrawable(pDrawable, bits, stride, bpp, xoff, yoff); +#ifdef __APPLE__ + if (bits >= 0xb0000000) return; // don't validate CG memory +#endif first = bits - stride; last = bits + stride * pDrawable->height; if (!fbValidateBits (first, stride, FB_HEAD_BITS) ||