backend: Add a backend release function

Mutter still relies heavily on singletons such as its MetaBackend.

For that, the backend implementation has a meta_init_backend() function
which is called at startup from meta_init(), which creates the desired
backend and sets the singleton which is returned by meta_get_backend().

Unfortunately, that means that the backend is never actually freed, and
all the code from the backend finalize function never actually get
called.

Add a meta_release_backend() to free the backend singleton.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1438
This commit is contained in:
Olivier Fourdan 2020-09-11 12:14:13 +02:00 committed by Georges Basile Stavracas Neto
parent c956193d09
commit 6db7d8f830
2 changed files with 7 additions and 0 deletions

View File

@ -108,6 +108,7 @@ struct _MetaBackendClass
}; };
void meta_init_backend (GType backend_gtype); void meta_init_backend (GType backend_gtype);
void meta_release_backend (void);
#ifdef HAVE_WAYLAND #ifdef HAVE_WAYLAND
MetaWaylandCompositor * meta_backend_get_wayland_compositor (MetaBackend *backend); MetaWaylandCompositor * meta_backend_get_wayland_compositor (MetaBackend *backend);

View File

@ -1393,6 +1393,12 @@ meta_init_backend (GType backend_gtype)
} }
} }
void
meta_release_backend (void)
{
g_clear_object (&_backend);
}
/** /**
* meta_is_stage_views_enabled: * meta_is_stage_views_enabled:
* *