m-std-event-source: don't crash in disable() if the core is not available

When the core is shutting down, the weak reference to it is cleared before
we have a change to use it, but it's ok because everything is getting destroyed
at this point, including the hook that we want to unregister.
This commit is contained in:
George Kiagiadakis
2023-01-04 12:49:53 +02:00
committed by Julian Bouzas
parent ce44d9a5ef
commit dbca5783d0

View File

@@ -364,9 +364,8 @@ wp_standard_event_source_disable (WpPlugin * plugin)
{
WpStandardEventSource * self = WP_STANDARD_EVENT_SOURCE (plugin);
g_autoptr (WpCore) core = wp_object_get_core (WP_OBJECT (plugin));
g_return_if_fail (core);
g_autoptr (WpEventDispatcher) dispatcher =
wp_event_dispatcher_get_instance (core);
g_autoptr (WpEventDispatcher) dispatcher = core ?
wp_event_dispatcher_get_instance (core) : NULL;
for (gint i = 0; i < N_OBJECT_TYPES; i++)
g_clear_object (&self->oms[i]);