diff options
| author | Chong Yidong | 2010-10-30 23:33:56 -0400 |
|---|---|---|
| committer | Chong Yidong | 2010-10-30 23:33:56 -0400 |
| commit | 46eadc7aeedf0fe3944291e2631d8604b38fe25f (patch) | |
| tree | ca0611a05414b498b9dfe430130153bf575131c8 /src | |
| parent | e084bc3d4106d616722c18a54df23382b1599dee (diff) | |
| download | emacs-46eadc7aeedf0fe3944291e2631d8604b38fe25f.tar.gz emacs-46eadc7aeedf0fe3944291e2631d8604b38fe25f.zip | |
Print informative error message when aborting on GTK disconnect.
* xterm.c (x_connection_closed): Print informative error message
when aborting on GTK. This requires using shut_down_emacs
directly instead of Fkill_emacs.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/xterm.c | 70 |
2 files changed, 39 insertions, 37 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index cf2ae75fc83..391dc3eaa07 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2010-10-31 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * xterm.c (x_connection_closed): Print informative error message | ||
| 4 | when aborting on GTK. This requires using shut_down_emacs | ||
| 5 | directly instead of Fkill_emacs. | ||
| 6 | |||
| 1 | 2010-10-25 Michael Albinus <michael.albinus@gmx.de> | 7 | 2010-10-25 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 8 | ||
| 3 | * dbusbind.c (Fdbus_call_method_asynchronously) | 9 | * dbusbind.c (Fdbus_call_method_asynchronously) |
diff --git a/src/xterm.c b/src/xterm.c index 143500256a1..808eaad3f5f 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -7882,48 +7882,44 @@ x_connection_closed (dpy, error_message) | |||
| 7882 | delete_frame (frame, Qnoelisp); | 7882 | delete_frame (frame, Qnoelisp); |
| 7883 | } | 7883 | } |
| 7884 | 7884 | ||
| 7885 | /* We have to close the display to inform Xt that it doesn't | 7885 | /* If DPYINFO is null, this means we didn't open the display in the |
| 7886 | exist anymore. If we don't, Xt will continue to wait for | 7886 | first place, so don't try to close it. */ |
| 7887 | events from the display. As a consequence, a sequence of | ||
| 7888 | |||
| 7889 | M-x make-frame-on-display RET :1 RET | ||
| 7890 | ...kill the new frame, so that we get an IO error... | ||
| 7891 | M-x make-frame-on-display RET :1 RET | ||
| 7892 | |||
| 7893 | will indefinitely wait in Xt for events for display `:1', opened | ||
| 7894 | in the first call to make-frame-on-display. | ||
| 7895 | |||
| 7896 | Closing the display is reported to lead to a bus error on | ||
| 7897 | OpenWindows in certain situations. I suspect that is a bug | ||
| 7898 | in OpenWindows. I don't know how to circumvent it here. */ | ||
| 7899 | |||
| 7900 | if (dpyinfo) | 7887 | if (dpyinfo) |
| 7901 | { | 7888 | { |
| 7902 | #ifdef USE_X_TOOLKIT | 7889 | #ifdef USE_X_TOOLKIT |
| 7903 | /* If DPYINFO is null, this means we didn't open the display | 7890 | /* We have to close the display to inform Xt that it doesn't |
| 7904 | in the first place, so don't try to close it. */ | 7891 | exist anymore. If we don't, Xt will continue to wait for |
| 7905 | { | 7892 | events from the display. As a consequence, a sequence of |
| 7906 | extern void (*fatal_error_signal_hook) P_ ((void)); | 7893 | |
| 7907 | fatal_error_signal_hook = x_fatal_error_signal; | 7894 | M-x make-frame-on-display RET :1 RET |
| 7908 | XtCloseDisplay (dpy); | 7895 | ...kill the new frame, so that we get an IO error... |
| 7909 | fatal_error_signal_hook = NULL; | 7896 | M-x make-frame-on-display RET :1 RET |
| 7910 | } | 7897 | |
| 7911 | #endif | 7898 | will indefinitely wait in Xt for events for display `:1', |
| 7899 | opened in the first call to make-frame-on-display. | ||
| 7900 | |||
| 7901 | Closing the display is reported to lead to a bus error on | ||
| 7902 | OpenWindows in certain situations. I suspect that is a bug | ||
| 7903 | in OpenWindows. I don't know how to circumvent it here. */ | ||
| 7904 | extern void (*fatal_error_signal_hook) P_ ((void)); | ||
| 7905 | fatal_error_signal_hook = x_fatal_error_signal; | ||
| 7906 | XtCloseDisplay (dpy); | ||
| 7907 | fatal_error_signal_hook = NULL; | ||
| 7908 | #endif /* USE_X_TOOLKIT */ | ||
| 7912 | 7909 | ||
| 7913 | #ifdef USE_GTK | 7910 | #ifdef USE_GTK |
| 7914 | /* There is a long-standing bug in GTK that prevents the GTK | 7911 | /* A long-standing GTK bug prevents proper disconnect handling |
| 7915 | main loop from recovering gracefully from disconnects | 7912 | (https://bugzilla.gnome.org/show_bug.cgi?id=85715). Once, |
| 7916 | (https://bugzilla.gnome.org/show_bug.cgi?id=85715). Among | 7913 | the resulting Glib error message loop filled a user's disk. |
| 7917 | other problems, this gives rise to a stream of Glib error | 7914 | To avoid this, kill Emacs unconditionally on disconnect. */ |
| 7918 | messages that, in one incident, filled up a user's hard disk | 7915 | shut_down_emacs (0, 0, Qnil); |
| 7919 | (http://lists.gnu.org/archive/html/emacs-devel/2010-10/msg00927.html). | 7916 | fprintf (stderr, "%s\n\ |
| 7920 | So, kill Emacs unconditionally if the display is closed. */ | 7917 | When compiled with GTK, Emacs cannot recover from X disconnects.\n\ |
| 7921 | { | 7918 | This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715\n\ |
| 7922 | fprintf (stderr, "%s\n", error_msg); | 7919 | For details, see etc/PROBLEMS.\n", |
| 7923 | Fkill_emacs (make_number (70)); | 7920 | error_msg); |
| 7924 | abort (); /* NOTREACHED */ | 7921 | abort (); |
| 7925 | } | 7922 | #endif /* USE_GTK */ |
| 7926 | #endif | ||
| 7927 | 7923 | ||
| 7928 | /* Indicate that this display is dead. */ | 7924 | /* Indicate that this display is dead. */ |
| 7929 | dpyinfo->display = 0; | 7925 | dpyinfo->display = 0; |