From: Daniel van Vugt Date: Tue, 5 Oct 2021 04:39:09 +0200 Subject: main: Avoid meta and gjs finalization This is a workaround to maintain a clean environment for gnome-shell and particularly JavaScript/GJS to shutdown without crashing. The main cause of shutdown crashes is _shell_global_destroy_gjs_context needing Clutter/Cogl resources to clean up, when those resources have already been destroyed by meta_finalize in meta_run. So by never calling meta_finalize via meta_run, we can simply avoid all those ordering conflicts that cause so many crashes. https://launchpad.net/bugs/1936826 verified fixed https://launchpad.net/bugs/1942031 verified fixed https://launchpad.net/bugs/1942121 verified fixed https://launchpad.net/bugs/1943406 expected fixed https://launchpad.net/bugs/1944054 expected fixed https://launchpad.net/bugs/1945010 expected fixed https://launchpad.net/bugs/1945116 expected fixed https://launchpad.net/bugs/1944388 expected fixed https://launchpad.net/bugs/1964458 expected fixed Proper fixes will eventually come upstream when these are finished or replaced by something else: https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1759 https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/648 Given that, and upstream's usual preference for proper permanent fixes, this will not be forwarded. Bug-Ubuntu: https://launchpad.net/bugs/1936826, https://launchpad.net/bugs/1942031, https://launchpad.net/bugs/1942121, https://launchpad.net/bugs/1943406, https://launchpad.net/bugs/1944054, https://launchpad.net/bugs/1945010, https://launchpad.net/bugs/1945116, https://launchpad.net/bugs/1944388, https://launchpad.net/bugs/1964458 Forwarded: no Last-Update: 2022-03-25 --- src/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 6604fde..77b035c 100644 --- a/src/main.c +++ b/src/main.c @@ -668,11 +668,17 @@ main (int argc, char **argv) ecode = EXIT_FAILURE; } - meta_context_destroy (g_steal_pointer (&context)); + // FIXME: We're leaking context here, but that's to prevent LP: #1936826 + g_steal_pointer (&context); shell_profiler_shutdown (); g_debug ("Doing final cleanup"); + + // Workaround live session crashes by leaking JS contexts (LP: #1964458) + if (g_strcmp0 (shell_global_get_session_mode (shell_global_get ()), "ubiquity") == 0) + return ecode; + _shell_global_destroy_gjs_context (shell_global_get ()); g_object_unref (shell_global_get ());