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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3242>
This commit is contained in:
Carlos Garnacho 2023-09-04 12:19:35 +02:00 committed by Marge Bot
parent cc874f5d33
commit 6427b5b1f6

View File

@ -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 *