diff options
| author | Dmitry Antipov | 2014-09-09 07:22:36 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2014-09-09 07:22:36 +0400 |
| commit | 80465f41d7fc67d40f0a233504e295b127ad2c6b (patch) | |
| tree | 799f7d502ee1f5027496e33c871600de62cba6dc | |
| parent | 755958bc72220af68a4e9f0f80e3d6b4f6478067 (diff) | |
| download | emacs-80465f41d7fc67d40f0a233504e295b127ad2c6b.tar.gz emacs-80465f41d7fc67d40f0a233504e295b127ad2c6b.zip | |
* xterm.c (x_term_init): Consolidate duplicated code.
[USE_LUCID]: Revert 2014-04-02 change (Bug#18403). Add comment.
(x_delete_terminal): Do not close X connection fd (Bug#18403).
Add eassert and mark dpyinfo as dead only if it was alive.
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/xterm.c | 33 |
2 files changed, 21 insertions, 19 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 4e01e155c2e..a01c753161c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2014-09-09 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | * xterm.c (x_term_init): Consolidate duplicated code. | ||
| 4 | [USE_LUCID]: Revert 2014-04-02 change (Bug#18403). Add comment. | ||
| 5 | (x_delete_terminal): Do not close X connection fd (Bug#18403). | ||
| 6 | Add eassert and mark dpyinfo as dead only if it was alive. | ||
| 7 | |||
| 1 | 2014-09-08 Eli Zaretskii <eliz@gnu.org> | 8 | 2014-09-08 Eli Zaretskii <eliz@gnu.org> |
| 2 | 9 | ||
| 3 | * dispnew.c (prepare_desired_row): When MODE_LINE_P is zero, | 10 | * dispnew.c (prepare_desired_row): When MODE_LINE_P is zero, |
diff --git a/src/xterm.c b/src/xterm.c index 767de9786cb..6ff33785a38 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -10667,7 +10667,6 @@ static unsigned x_display_id; | |||
| 10667 | struct x_display_info * | 10667 | struct x_display_info * |
| 10668 | x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | 10668 | x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) |
| 10669 | { | 10669 | { |
| 10670 | int connection; | ||
| 10671 | Display *dpy; | 10670 | Display *dpy; |
| 10672 | struct terminal *terminal; | 10671 | struct terminal *terminal; |
| 10673 | struct x_display_info *dpyinfo; | 10672 | struct x_display_info *dpyinfo; |
| @@ -11110,22 +11109,19 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 11110 | 11109 | ||
| 11111 | xsettings_initialize (dpyinfo); | 11110 | xsettings_initialize (dpyinfo); |
| 11112 | 11111 | ||
| 11113 | connection = ConnectionNumber (dpyinfo->display); | ||
| 11114 | |||
| 11115 | /* This is only needed for distinguishing keyboard and process input. */ | 11112 | /* This is only needed for distinguishing keyboard and process input. */ |
| 11116 | if (connection != 0) | 11113 | if (dpyinfo->connection != 0) |
| 11117 | add_keyboard_wait_descriptor (connection); | 11114 | add_keyboard_wait_descriptor (dpyinfo->connection); |
| 11118 | 11115 | ||
| 11119 | #ifdef F_SETOWN | 11116 | #ifdef F_SETOWN |
| 11120 | fcntl (connection, F_SETOWN, getpid ()); | 11117 | fcntl (dpyinfo->connection, F_SETOWN, getpid ()); |
| 11121 | #endif /* ! defined (F_SETOWN) */ | 11118 | #endif /* ! defined (F_SETOWN) */ |
| 11122 | 11119 | ||
| 11123 | if (interrupt_input) | 11120 | if (interrupt_input) |
| 11124 | init_sigio (connection); | 11121 | init_sigio (dpyinfo->connection); |
| 11125 | 11122 | ||
| 11126 | #ifdef USE_LUCID | 11123 | #ifdef USE_LUCID |
| 11127 | { | 11124 | { |
| 11128 | XFontStruct *xfont = NULL; | ||
| 11129 | XrmValue d, fr, to; | 11125 | XrmValue d, fr, to; |
| 11130 | Font font; | 11126 | Font font; |
| 11131 | 11127 | ||
| @@ -11139,10 +11135,10 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 11139 | x_catch_errors (dpy); | 11135 | x_catch_errors (dpy); |
| 11140 | if (!XtCallConverter (dpy, XtCvtStringToFont, &d, 1, &fr, &to, NULL)) | 11136 | if (!XtCallConverter (dpy, XtCvtStringToFont, &d, 1, &fr, &to, NULL)) |
| 11141 | emacs_abort (); | 11137 | emacs_abort (); |
| 11142 | if (x_had_errors_p (dpy) || !((xfont = XQueryFont (dpy, font)))) | 11138 | if (x_had_errors_p (dpy) || !XQueryFont (dpy, font)) |
| 11143 | XrmPutLineResource (&xrdb, "Emacs.dialog.*.font: 9x15"); | 11139 | XrmPutLineResource (&xrdb, "Emacs.dialog.*.font: 9x15"); |
| 11144 | if (xfont) | 11140 | /* Do not free XFontStruct returned by the above call to XQueryFont. |
| 11145 | XFreeFont (dpy, xfont); | 11141 | This leads to X protocol errors at XtCloseDisplay (Bug#18403). */ |
| 11146 | x_uncatch_errors (); | 11142 | x_uncatch_errors (); |
| 11147 | } | 11143 | } |
| 11148 | #endif | 11144 | #endif |
| @@ -11375,18 +11371,17 @@ x_delete_terminal (struct terminal *terminal) | |||
| 11375 | XCloseDisplay (dpyinfo->display); | 11371 | XCloseDisplay (dpyinfo->display); |
| 11376 | #endif | 11372 | #endif |
| 11377 | #endif /* ! USE_GTK */ | 11373 | #endif /* ! USE_GTK */ |
| 11378 | } | ||
| 11379 | 11374 | ||
| 11380 | /* No more input on this descriptor. */ | 11375 | /* No more input on this descriptor. Do not close it because |
| 11381 | if (0 <= dpyinfo->connection) | 11376 | it's already closed by X(t)CloseDisplay (Bug#18403). */ |
| 11382 | { | 11377 | eassert (0 <= dpyinfo->connection); |
| 11383 | delete_keyboard_wait_descriptor (dpyinfo->connection); | 11378 | delete_keyboard_wait_descriptor (dpyinfo->connection); |
| 11384 | emacs_close (dpyinfo->connection); | 11379 | |
| 11380 | /* Mark as dead. */ | ||
| 11381 | dpyinfo->display = NULL; | ||
| 11382 | dpyinfo->connection = -1; | ||
| 11385 | } | 11383 | } |
| 11386 | 11384 | ||
| 11387 | /* Mark as dead. */ | ||
| 11388 | dpyinfo->display = NULL; | ||
| 11389 | dpyinfo->connection = -1; | ||
| 11390 | x_delete_display (dpyinfo); | 11385 | x_delete_display (dpyinfo); |
| 11391 | unblock_input (); | 11386 | unblock_input (); |
| 11392 | } | 11387 | } |