New Issue following up on Issue #221 Emacs disconnects
Attached is a reduced test case which was requested in the now closed issue glib#221 (closed) - quickly sloppily hacked up from simple.c from gtk+-demos.
gtk_main is replaced by a loop which calls g_main_context_iteration. X errors are handled via XSetIOErrorHandler and XSetErrorHandler to handle a closed display and continue with the next g_main_context_iteration.
To Run the test case: gcc simple.c -Wno-deprecated -Wno-deprecated-declarations -g3 $(pkg-config gtk+-3.0 --cflags --libs ) -lX11 $ DISPLAY=:0 Xephyr :1 $ DISPLAY=:1 G_DEBUG=fatal-warnings ./a.out kill Xephyr
The stack trace which you get from killing Xephyr is attached.