[mutter] xwayland: Set libX11 error handlers to no-ops before terminating
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] xwayland: Set libX11 error handlers to no-ops before terminating
- Date: Wed, 5 May 2021 20:26:21 +0000 (UTC)
commit b71f52ff32d99a4305dc5f36d19086c9692afde0
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Tue Apr 20 19:00:14 2021 +0200
xwayland: Set libX11 error handlers to no-ops before terminating
We might not be the only entity holding on to the X11 GdkDisplay,
meaning the X11 connection will stay alive indefinitely, e.g. if the gjs
context has some reference to it.
Avoid running into issues due to X11 connection errors by setting the
libX11 handlers to no-ops, so when we are terminating; that means the
GDK X11 connection can stay "alive" until its too late, and we'll just
silently ignore any connection errors that may happen due to the
lingering GDK display reference.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
src/wayland/meta-xwayland.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
---
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 287bce2d2f..d83c8c770e 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -607,6 +607,12 @@ x_io_error (Display *display)
return 0;
}
+static int
+x_io_error_noop (Display *display)
+{
+ return 0;
+}
+
#ifdef HAVE_XSETIOERROREXITHANDLER
static void
x_io_error_exit (Display *display,
@@ -619,6 +625,12 @@ x_io_error_exit (Display *display,
manager->xserver_grace_period_id =
g_idle_add (shutdown_xwayland_cb, manager);
}
+
+static void
+x_io_error_exit_noop (Display *display,
+ void *data)
+{
+}
#endif
void
@@ -1264,10 +1276,19 @@ meta_xwayland_connection_release (MetaXWaylandConnection *connection)
void
meta_xwayland_shutdown (MetaXWaylandManager *manager)
{
+#ifdef HAVE_XSETIOERROREXITHANDLER
+ MetaX11Display *x11_display = meta_get_display ()->x11_display;
+#endif
char path[256];
g_cancellable_cancel (manager->xserver_died_cancellable);
+ XSetIOErrorHandler (x_io_error_noop);
+#ifdef HAVE_XSETIOERROREXITHANDLER
+ XSetIOErrorExitHandler (meta_x11_display_get_xdisplay (x11_display),
+ x_io_error_exit_noop, NULL);
+#endif
+
snprintf (path, sizeof path, "%s%d", X11_TMP_UNIX_PATH,
manager->public_connection.display_index);
unlink (path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]