Avoid BadMatch Error
Philip Dicke
Philip.Dicke at raytheon.com
Wed Jul 21 07:37:48 CDT 2004
Sometimes, when converting from a disabled pixmap for an icon in
x11drv/bitblt.c, an area is requested using XGetImage that is larger then
the actual drawable. This causes a X BadMatch error and wine immediately
exits. The submitted patch avoids this error by checking the size of the
requested area and the size of the drawable in BITBLT_GetSrcArea. If the
requested area is not completely on the drawable, an ERR is printed and the
function returns. See bug 2273 for more details. This partially fixes bug
2273. I know that I am submitting a patch against a CVS snapshot from
7/20, however, I checked CVS and bitblt.c has not been changed recently.
Change log:
dlls/x11drv/bitblt.c - Avoid BadMatch in Mono -> Color conversion
--- wine_orig/dlls/x11drv/bitblt.c 2004-04-26 16:06:08.000000000 -0400
+++ wine/dlls/x11drv/bitblt.c 2004-07-20 18:35:34.000000000 -0400
@@ -996,7 +996,19 @@
}
else /* color -> monochrome */
{
- /* FIXME: avoid BadMatch error */
+ /* avoid BadMatch error when request is too big for the
drawable*/
+ unsigned int d_w, d_h, dummy_uint;
+ int d_x, d_y;
+ Window dummy_window;
+ XGetGeometry(gdi_display, physDevSrc->drawable, &dummy_window,
&d_x, &d_y,
+ &d_w, &d_h, &dummy_uint, &dummy_uint);
+ if(physDevSrc->org.x + visRectSrc->left + width > d_x + d_w ||
+ physDevSrc->org.y + visRectSrc->top + height > d_y + d_h
)
+ {
+ ERR("XGetImage Request too big for drawable\n");
+ return exposures;
+ }
+ /* FIXME: avoid BadMatch error when drawable is not visible*/
imageSrc = XGetImage( gdi_display, physDevSrc->drawable,
physDevSrc->org.x + visRectSrc->left,
physDevSrc->org.y + visRectSrc->top,
More information about the wine-patches
mailing list