Subject: bug#11741:

From: Alejandro Benitez <[email-masked]>
Date: Mon, 23 Jul 2012 01:08:21 -0300

Glenn Morris <[email-masked]> writes:

> woddfellow2 wrote:
>
>> If I start an Emacs daemon, even outside of X, then open an emacsclient
>> frame in X, then C-x 5 0, then exit X, the daemon dies. This happens
>> even with emacs -Q. This appears to e a regression, as Emacs 23 did not
>> have this problem:
>>
>>   Connection lost to X server `:0'
>>   When compiled with GTK, Emacs cannot recover from X disconnects.
>>   This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715
>>   For details, see etc/PROBLEMS.
>
> The above message seems pretty clear to me.
>
> Here's what the etc/PROBLEMS entry says:
>
>     ** When Emacs is compiled with Gtk+, closing a display kills Emacs.
>
>     There is a long-standing bug in GTK that prevents it from recovering
>     from disconnects: http://bugzilla.gnome.org/show_bug.cgi?id=85715.
>
>     Thus, for instance, when Emacs is run as a server on a text terminal,
>     and an X frame is created, and the X server for that frame crashes or
>     exits unexpectedly, Emacs must exit to prevent a GTK error that would
>     result in an endless loop.
>
>     If you need Emacs to be able to recover from closing displays, compile
>     it with the Lucid toolkit instead of GTK.

Hi,

Looks like this actually is a regression as the steps to reproduce
that described the OP are not the the same as the know problem.

1. I start an Emacs daemon, even outside of X
2. then open an emacsclient frame in X
3. then C-x 5 0
4. then exit X
5. the daemon dies

Step 3 means that the frame should be deleted before the X server for
that frame would supposedly crash or exit unexpectedly. The actual
problem is that the frame is not successfully deleted before exiting X,
although it looks like it does. Emacs 23.4.1 does delete the frame
successfully, so when I exit the X server I don't get a "there is
currently 1 client connected" message that when I get with Emacs 24.1.

I was able to reproduce this in Emacs 24.1 i686-pc-cygwin, GTK+.
Emacs 23.4.1 i686-pc-cygwin, GTK+ does not die after performing the
4 steps above.