object-manager: don't try to install if there is no core

This happens when the daemon fails to connect and the
not installed object managers try to get installed, but
the weak ref to the core is already gone
This commit is contained in:
George Kiagiadakis 2020-05-13 19:52:25 +03:00
parent 386c75f3b9
commit d89c4ecd94

View file

@ -775,11 +775,13 @@ wp_object_manager_maybe_objects_changed (WpObjectManager * self)
*/
else if (!self->installed) {
g_autoptr (WpCore) core = g_weak_ref_get (&self->core);
WpRegistry *reg = wp_core_get_registry (core);
if (reg->tmp_globals->len == 0 && reg->globals->len != 0) {
wp_trace_object (self, "installed");
g_signal_emit (self, signals[SIGNAL_INSTALLED], 0);
self->installed = TRUE;
if (core) {
WpRegistry *reg = wp_core_get_registry (core);
if (reg->tmp_globals->len == 0 && reg->globals->len != 0) {
wp_trace_object (self, "installed");
g_signal_emit (self, signals[SIGNAL_INSTALLED], 0);
self->installed = TRUE;
}
}
}
}