# HG changeset patch # User Kenichi Handa # Date 923964712 0 # Node ID b18f51ec1b6cfd749c2e8fd834618fb541b74410 # Parent a9d05d95717dbaf34c14e2e1edf3f9d921c38eee Trap X errors so that Emacs doesn't die by them. diff -r a9d05d95717d -r b18f51ec1b6c src/xterm.c --- a/src/xterm.c Mon Apr 12 18:25:26 1999 +0000 +++ b/src/xterm.c Tue Apr 13 00:51:52 1999 +0000 @@ -6505,12 +6505,22 @@ /* At first, put PATTERN in the cache. */ BLOCK_INPUT; + count = x_catch_errors (dpy); + if (try_XLoadQueryFont) { XFontStruct *font; unsigned long value; font = XLoadQueryFont (dpy, XSTRING (pattern)->data); + if (x_had_errors_p (dpy)) + { + /* This error is perhaps due to insufficient memory on X + server. Let's just ignore it. */ + font = NULL; + x_clear_errors (dpy); + } + if (font && XGetFontProperty (font, XA_FONT, &value)) { @@ -6542,10 +6552,21 @@ } if (!try_XLoadQueryFont) - /* We try at least 10 fonts because XListFonts will return - auto-scaled fonts at the head. */ - names = XListFonts (dpy, XSTRING (pattern)->data, max (maxnames, 10), - &num_fonts); + { + /* We try at least 10 fonts because XListFonts will return + auto-scaled fonts at the head. */ + names = XListFonts (dpy, XSTRING (pattern)->data, max (maxnames, 10), + &num_fonts); + if (x_had_errors_p (dpy)) + { + /* This error is perhaps due to insufficient memory on X + server. Let's just ignore it. */ + names = NULL; + x_clear_errors (dpy); + } + } + + x_uncatch_errors (dpy, count); UNBLOCK_INPUT; if (names) @@ -6627,8 +6648,17 @@ XFontStruct *thisinfo; BLOCK_INPUT; + count = x_catch_errors (dpy); thisinfo = XLoadQueryFont (dpy, XSTRING (XCONS (tem)->car)->data); + if (x_had_errors_p (dpy)) + { + /* This error is perhaps due to insufficient memory on X + server. Let's just ignore it. */ + thisinfo = NULL; + x_clear_errors (dpy); + } + x_uncatch_errors (dpy, count); UNBLOCK_INPUT; if (thisinfo)