Cleaner ShellGlobal and JS Destruction

Marco Trevisan requested to merge 3v1n0/gnome-shell:cleaner-shutdown into main

This is the follow-up for mutter!682 (closed), although there's not strict dependency on it, the mutter branch will crash without these changes.

The main change here is to ensure that everything that should have the same lifecycle of the shell is managed by the ShellGlobal object and that is destroyed in order making sure that everything that is allocated by the Shell (directly or via gjs) is disposed when ShellGlobal is destroyed and before than the mutter backend (and the clutter stage).

Then ensure that when we restart or quit the shell via proper commands we perform the shutdown keeping the same order and freeing all the shell and mutter resources first.

Merge request reports