From 6427b5b1f6aea16054b2b0d8a8a4eb11e0b4828a Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Mon, 4 Sep 2023 12:19:35 +0200 Subject: [PATCH] backends/x11: Prevent uneven error traps init/deinit on GInitable failure GInitable initialization is failable, currently, it may fail before error traps are initialized, but error traps would be invariably deinitialized on finalize() of the failed object. This results in an assert hit, on top of the original failure to initialize the backend. The libX11 error handlers are a pure client-side construct, and not a server request, they just need XInitThreads() called to set up the library-side locks protecting access to the global variable. This is done beforehand already at meta_backend_x11_init(), so initialize the error traps around that time too. Part-of: --- src/backends/x11/meta-backend-x11.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/backends/x11/meta-backend-x11.c b/src/backends/x11/meta-backend-x11.c index 9f509bdee..f13453a19 100644 --- a/src/backends/x11/meta-backend-x11.c +++ b/src/backends/x11/meta-backend-x11.c @@ -904,8 +904,6 @@ meta_backend_x11_initable_init (GInitable *initable, XSynchronize (xdisplay, meta_context_is_x11_sync (context)); - mtk_x11_errors_init (); - priv->xdisplay = xdisplay; priv->xscreen = DefaultScreenOfDisplay (xdisplay); priv->xcb = XGetXCBConnection (priv->xdisplay); @@ -997,6 +995,7 @@ static void meta_backend_x11_init (MetaBackendX11 *x11) { XInitThreads (); + mtk_x11_errors_init (); } Display *