main: Destroy GjsContext before exit

This will be required in the upcoming version of GJS.

The reference count on ShellGlobal is 2 at this point, because JS holds a
reference due to the "window.global = Shell.Global.get()" line in
ui/environment.js. Therefore, destroy the GjsContext first, then unref
the ShellGlobal object.

Cleaning up ShellGlobal was previously only enabled behind a debug
environment variable, but it should be required now.

https://bugzilla.gnome.org/show_bug.cgi?id=775374
This commit is contained in:
Philip Chimento
2016-12-05 17:31:08 -08:00
parent 56b20ef779
commit 83005e27da
3 changed files with 20 additions and 7 deletions

View File

@ -469,12 +469,9 @@ main (int argc, char **argv)
ecode = meta_run ();
if (g_getenv ("GNOME_SHELL_ENABLE_CLEANUP"))
{
g_printerr ("Doing final cleanup...\n");
g_object_unref (shell_global_get ());
}
g_debug ("Doing final cleanup");
_shell_global_destroy_gjs_context (shell_global_get ());
g_object_unref (shell_global_get ());
g_object_unref (sender);
return ecode;