x11: gracefully handle X11 connection error

Perform X11 connection recovery via XSetIOErrorExitHandler mechanism.

Implementation is largely inspired by this change to GNOME/mutter
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1447

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/441>
This commit is contained in:
Igor V. Kovalenko 2020-12-22 20:54:40 +03:00 committed by PulseAudio Marge Bot
parent 28f646fd87
commit b6396dbe9c
8 changed files with 81 additions and 6 deletions

View file

@ -93,6 +93,8 @@ static void x11_kill_cb(pa_x11_wrapper *w, void *userdata) {
pa_assert(u);
pa_assert(u->x11_wrapper == w);
pa_log_debug("X11 client kill callback called");
if (u->x11_client)
pa_x11_client_free(u->x11_client);

View file

@ -66,6 +66,8 @@ static void x11_kill_cb(pa_x11_wrapper *w, void *userdata) {
pa_assert(u);
pa_assert(u->x11_wrapper == w);
pa_log_debug("X11 client kill callback called");
if (u->x11_client) {
pa_x11_client_free(u->x11_client);
u->x11_client = NULL;

View file

@ -116,6 +116,8 @@ static void x11_kill_cb(pa_x11_wrapper *w, void *userdata) {
pa_assert(u);
pa_assert(u->x11_wrapper == w);
pa_log_debug("X11 client kill callback called");
if (u->x11_client)
pa_x11_client_free(u->x11_client);

View file

@ -64,7 +64,7 @@ static void die_cb(SmcConn connection, SmPointer client_data) {
pa_log_debug("Got die message from XSMP.");
pa_x11_wrapper_kill(u->x11);
pa_x11_wrapper_kill_deferred(u->x11);
pa_x11_wrapper_unref(u->x11);
u->x11 = NULL;