Hi all, It seems that a lot of people out there are still using the 'old' core fonts rendering path for fonts (maybe one familiar with 'wineinstall' should have it print a help message telling people to install the MS core fonts in their Windows/Fonts directory). As seen on bug 1555 (http://bugs.winehq.com/show_bug.cgi?id=1555), the call generating the X11 error is 'XLoadQueryFont'. So let's protect this with our own X11 error mechanism as we do for DGA2 for example and do as if the loading of the font failed. This was not tested yet as I did not find an user who 1) had built Wine himself and 2) had the font issue. But well, according to 1555, it should work :-) Changelog: - do not have Wine crash when trying to load bad fonts -- Lionel Ulmer - http://www.bbrox.org/
Index: graphics/x11drv/xfont.c =================================================================== RCS file: /home/wine/wine/graphics/x11drv/xfont.c,v retrieving revision 1.114 diff -u -r1.114 xfont.c --- graphics/x11drv/xfont.c 18 Jun 2003 19:45:22 -0000 1.114 +++ graphics/x11drv/xfont.c 5 Jul 2003 10:31:32 -0000 @@ -2014,6 +2014,11 @@ * * Build font metrics from X font */ +static int XLoadQueryFont_ErrorHandler(Display *dpy, XErrorEvent *event, void *arg) +{ + return 1; +} + static int XFONT_BuildMetrics(char** x_pattern, int res, unsigned x_checksum, int x_count) { int i; @@ -2115,7 +2120,13 @@ } else lpstr = x_pattern[i]; - if( (x_fs = TSXLoadQueryFont(gdi_display, lpstr)) ) + /* X11 may return an error on some bad fonts... So be prepared to handle these. */ + wine_tsx11_lock(); + X11DRV_expect_error(gdi_display, XLoadQueryFont_ErrorHandler, NULL); + x_fs = XLoadQueryFont(gdi_display, lpstr); + if (X11DRV_check_error()) x_fs = 0; + wine_tsx11_unlock(); + if (x_fs != 0) { XFONT_SetFontMetric( fi, fr, x_fs ); TSXFreeFont( gdi_display, x_fs );