display: Remove weak references on display disposition
Weak references are added when logical monitors are created, however we don't remove them when destroying the display. This means that if a monitor survives to the display finalization (because may be referenced elsewhere) it will make g-c-c to crash during its finalization, as that will trigger the weak reference callback that will try to access to the already-finalized display.
This commit is contained in:
parent
8809dbc565
commit
c6da230052
1 changed files with 20 additions and 0 deletions
|
@ -1665,6 +1665,25 @@ cc_display_config_dbus_get_property (GObject *object,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cc_display_config_dbus_dispose (GObject *object)
|
||||
{
|
||||
CcDisplayConfigDBus *self = CC_DISPLAY_CONFIG_DBUS (object);
|
||||
|
||||
if (self->logical_monitors)
|
||||
{
|
||||
GHashTableIter iter;
|
||||
gpointer monitor;
|
||||
|
||||
g_hash_table_iter_init (&iter, self->logical_monitors);
|
||||
|
||||
while (g_hash_table_iter_next (&iter, &monitor, NULL))
|
||||
g_object_weak_unref (G_OBJECT (monitor), remove_logical_monitor, self);
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (cc_display_config_dbus_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_display_config_dbus_finalize (GObject *object)
|
||||
{
|
||||
|
@ -1692,6 +1711,7 @@ cc_display_config_dbus_class_init (CcDisplayConfigDBusClass *klass)
|
|||
gobject_class->constructed = cc_display_config_dbus_constructed;
|
||||
gobject_class->set_property = cc_display_config_dbus_set_property;
|
||||
gobject_class->get_property = cc_display_config_dbus_get_property;
|
||||
gobject_class->dispose = cc_display_config_dbus_dispose;
|
||||
gobject_class->finalize = cc_display_config_dbus_finalize;
|
||||
|
||||
parent_class->get_monitors = cc_display_config_dbus_get_monitors;
|
||||
|
|
Loading…
Add table
Reference in a new issue