shell: Make singletons owned by ShellGlobal

This means also means they will be cleaned up when disposing
ShellGlobal, which will then mean signals tied to the GObject lifetime
will be disconnected.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6536
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2722>
This commit is contained in:
Jonas Ådahl
2023-03-24 10:16:07 +01:00
parent 517482b562
commit ff705fa902
7 changed files with 93 additions and 27 deletions

View File

@ -763,10 +763,5 @@ on_enable_monitoring_key_changed (GSettings *settings,
ShellAppUsage *
shell_app_usage_get_default (void)
{
static ShellAppUsage *instance;
if (instance == NULL)
instance = g_object_new (SHELL_TYPE_APP_USAGE, NULL);
return instance;
return shell_global_get_app_usage (shell_global_get ());
}