diff options
| -rw-r--r-- | src/xterm.c | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/src/xterm.c b/src/xterm.c index 86fd43ac162..629e2946d95 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -6505,12 +6505,22 @@ x_list_fonts (f, pattern, size, maxnames) | |||
| 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 | { |
| @@ -6542,10 +6552,21 @@ x_list_fonts (f, pattern, size, maxnames) | |||
| 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) |
| @@ -6627,8 +6648,17 @@ x_list_fonts (f, pattern, size, maxnames) | |||
| 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) |