Mercurial > emacs
comparison src/xterm.c @ 24618:b18f51ec1b6c
Trap X errors so that Emacs doesn't die
by them.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Tue, 13 Apr 1999 00:51:52 +0000 |
parents | 6f4ae209bbac |
children | c7d905dca6ba |
comparison
equal
deleted
inserted
replaced
24617:a9d05d95717d | 24618:b18f51ec1b6c |
---|---|
6503 } | 6503 } |
6504 | 6504 |
6505 /* At first, put PATTERN in the cache. */ | 6505 /* At first, put PATTERN in the cache. */ |
6506 | 6506 |
6507 BLOCK_INPUT; | 6507 BLOCK_INPUT; |
6508 count = x_catch_errors (dpy); | |
6509 | |
6508 if (try_XLoadQueryFont) | 6510 if (try_XLoadQueryFont) |
6509 { | 6511 { |
6510 XFontStruct *font; | 6512 XFontStruct *font; |
6511 unsigned long value; | 6513 unsigned long value; |
6512 | 6514 |
6513 font = XLoadQueryFont (dpy, XSTRING (pattern)->data); | 6515 font = XLoadQueryFont (dpy, XSTRING (pattern)->data); |
6516 if (x_had_errors_p (dpy)) | |
6517 { | |
6518 /* This error is perhaps due to insufficient memory on X | |
6519 server. Let's just ignore it. */ | |
6520 font = NULL; | |
6521 x_clear_errors (dpy); | |
6522 } | |
6523 | |
6514 if (font | 6524 if (font |
6515 && XGetFontProperty (font, XA_FONT, &value)) | 6525 && XGetFontProperty (font, XA_FONT, &value)) |
6516 { | 6526 { |
6517 char *name = (char *) XGetAtomName (dpy, (Atom) value); | 6527 char *name = (char *) XGetAtomName (dpy, (Atom) value); |
6518 int len = strlen (name); | 6528 int len = strlen (name); |
6540 if (font) | 6550 if (font) |
6541 XFreeFont (dpy, font); | 6551 XFreeFont (dpy, font); |
6542 } | 6552 } |
6543 | 6553 |
6544 if (!try_XLoadQueryFont) | 6554 if (!try_XLoadQueryFont) |
6545 /* We try at least 10 fonts because XListFonts will return | 6555 { |
6546 auto-scaled fonts at the head. */ | 6556 /* We try at least 10 fonts because XListFonts will return |
6547 names = XListFonts (dpy, XSTRING (pattern)->data, max (maxnames, 10), | 6557 auto-scaled fonts at the head. */ |
6548 &num_fonts); | 6558 names = XListFonts (dpy, XSTRING (pattern)->data, max (maxnames, 10), |
6559 &num_fonts); | |
6560 if (x_had_errors_p (dpy)) | |
6561 { | |
6562 /* This error is perhaps due to insufficient memory on X | |
6563 server. Let's just ignore it. */ | |
6564 names = NULL; | |
6565 x_clear_errors (dpy); | |
6566 } | |
6567 } | |
6568 | |
6569 x_uncatch_errors (dpy, count); | |
6549 UNBLOCK_INPUT; | 6570 UNBLOCK_INPUT; |
6550 | 6571 |
6551 if (names) | 6572 if (names) |
6552 { | 6573 { |
6553 int i; | 6574 int i; |
6625 /* Since we have not yet known the size of this font, we | 6646 /* Since we have not yet known the size of this font, we |
6626 must try slow function call XLoadQueryFont. */ | 6647 must try slow function call XLoadQueryFont. */ |
6627 XFontStruct *thisinfo; | 6648 XFontStruct *thisinfo; |
6628 | 6649 |
6629 BLOCK_INPUT; | 6650 BLOCK_INPUT; |
6651 count = x_catch_errors (dpy); | |
6630 thisinfo = XLoadQueryFont (dpy, | 6652 thisinfo = XLoadQueryFont (dpy, |
6631 XSTRING (XCONS (tem)->car)->data); | 6653 XSTRING (XCONS (tem)->car)->data); |
6654 if (x_had_errors_p (dpy)) | |
6655 { | |
6656 /* This error is perhaps due to insufficient memory on X | |
6657 server. Let's just ignore it. */ | |
6658 thisinfo = NULL; | |
6659 x_clear_errors (dpy); | |
6660 } | |
6661 x_uncatch_errors (dpy, count); | |
6632 UNBLOCK_INPUT; | 6662 UNBLOCK_INPUT; |
6633 | 6663 |
6634 if (thisinfo) | 6664 if (thisinfo) |
6635 { | 6665 { |
6636 XCONS (tem)->cdr | 6666 XCONS (tem)->cdr |