diff options
| author | Po Lu | 2022-11-01 19:11:19 +0800 |
|---|---|---|
| committer | Po Lu | 2022-11-01 19:20:15 +0800 |
| commit | eb68c3d5a23e519a4b9ffc7b87fa7db68a18ae0b (patch) | |
| tree | 9defa160543f8ac3f3303f9123a402d47b0d8b7f | |
| parent | 123baf3772e71a33eabc1b1169a9b778e2fe3877 (diff) | |
| download | emacs-eb68c3d5a23e519a4b9ffc7b87fa7db68a18ae0b.tar.gz emacs-eb68c3d5a23e519a4b9ffc7b87fa7db68a18ae0b.zip | |
Fix leak on Lucid build
* src/xterm.c (x_term_init): Rectify wrong fix for bug#18403.
| -rw-r--r-- | src/xterm.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/xterm.c b/src/xterm.c index 7dd969b821f..d8358269f60 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -29778,21 +29778,30 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 29778 | { | 29778 | { |
| 29779 | XrmValue d, fr, to; | 29779 | XrmValue d, fr, to; |
| 29780 | Font font; | 29780 | Font font; |
| 29781 | XFontStruct *query_result; | ||
| 29781 | 29782 | ||
| 29782 | dpy = dpyinfo->display; | 29783 | dpy = dpyinfo->display; |
| 29783 | d.addr = (XPointer)&dpy; | 29784 | d.addr = (XPointer) &dpy; |
| 29784 | d.size = sizeof (Display *); | 29785 | d.size = sizeof (Display *); |
| 29785 | fr.addr = (char *) XtDefaultFont; | 29786 | fr.addr = (char *) XtDefaultFont; |
| 29786 | fr.size = sizeof (XtDefaultFont); | 29787 | fr.size = sizeof (XtDefaultFont); |
| 29787 | to.size = sizeof (Font *); | 29788 | to.size = sizeof (Font *); |
| 29788 | to.addr = (XPointer)&font; | 29789 | to.addr = (XPointer) &font; |
| 29789 | x_catch_errors (dpy); | 29790 | x_catch_errors (dpy); |
| 29790 | if (!XtCallConverter (dpy, XtCvtStringToFont, &d, 1, &fr, &to, NULL)) | 29791 | if (!XtCallConverter (dpy, XtCvtStringToFont, &d, 1, &fr, &to, NULL)) |
| 29791 | emacs_abort (); | 29792 | emacs_abort (); |
| 29792 | if (x_had_errors_p (dpy) || !XQueryFont (dpy, font)) | 29793 | query_result = XQueryFont (dpy, font); |
| 29794 | |||
| 29795 | /* Set the dialog font to some fallback (here, 9x15) if the font | ||
| 29796 | specified is invalid. */ | ||
| 29797 | if (x_had_errors_p (dpy) || !font) | ||
| 29793 | XrmPutLineResource (&xrdb, "Emacs.dialog.*.font: 9x15"); | 29798 | XrmPutLineResource (&xrdb, "Emacs.dialog.*.font: 9x15"); |
| 29794 | /* Do not free XFontStruct returned by the above call to XQueryFont. | 29799 | |
| 29795 | This leads to X protocol errors at XtCloseDisplay (Bug#18403). */ | 29800 | /* Do not destroy the font struct returned above with XFreeFont; |
| 29801 | that also destroys the font, leading to to X protocol errors at | ||
| 29802 | XtCloseDisplay. Just free the font info structure. | ||
| 29803 | (Bug#18403) */ | ||
| 29804 | XFreeFontInfo (NULL, query_result, 0); | ||
| 29796 | x_uncatch_errors (); | 29805 | x_uncatch_errors (); |
| 29797 | } | 29806 | } |
| 29798 | #endif | 29807 | #endif |