Subject: bug#18375: 24.4.50; Emacs hangs X session manager logout in certain cases

From: Christoph Ruegge <[email-masked]>
Date: Mon, 1 Sep 2014 13:40:55 +0200

> I don't know precisely why this causes the
> bug, since the SM connection is supposed to be shut down in
> x_delete_display(), but I am pretty sure that the bug happens if and
> only if the first terminal has been closed.

Adding to this, I think the reason is that the call to x_session_close() in
x_delete_display() deletes the connection's FD, but does not actually tell the
SM to close. Adding a call to SmcCloseConnection() to x_session_close()
solves the hanging behaviour for me, but of course retains the weird behaviour
of Emacs not shutting down if the first terminal was closed.