gtkplacessidebar: Disconnect and unref cloud_manager in dispose

The manager's providers-changed signal can fire after the sidebar has
been freed. Make sure we disconnect the sidebar from the manager.

https://bugs.archlinux.org/task/57984
https://bugs.archlinux.org/task/68123
This commit is contained in:
Jan Alexander Steffens (heftig) 2020-10-06 22:34:11 -04:00 committed by Matthias Clasen
parent 3d9eb61bba
commit fb0c062506

View File

@ -4011,17 +4011,23 @@ gtk_places_sidebar_dispose (GObject *object)
g_clear_object (&sidebar->shortcuts);
#ifdef HAVE_CLOUDPROVIDERS
for (l = cloud_providers_collector_get_providers (sidebar->cloud_manager);
l != NULL; l = l->next)
{
g_signal_handlers_disconnect_by_data (l->data, sidebar);
}
for (l = sidebar->unready_accounts; l != NULL; l = l->next)
{
g_signal_handlers_disconnect_by_data (l->data, sidebar);
}
g_list_free_full (sidebar->unready_accounts, g_object_unref);
sidebar->unready_accounts = NULL;
if (sidebar->cloud_manager)
{
g_signal_handlers_disconnect_by_data (sidebar->cloud_manager, sidebar);
for (l = cloud_providers_collector_get_providers (sidebar->cloud_manager);
l != NULL; l = l->next)
{
g_signal_handlers_disconnect_by_data (l->data, sidebar);
}
g_object_unref (sidebar->cloud_manager);
sidebar->cloud_manager = NULL;
}
#endif
G_OBJECT_CLASS (gtk_places_sidebar_parent_class)->dispose (object);
@ -4034,10 +4040,6 @@ gtk_places_sidebar_finalize (GObject *object)
g_clear_object (&sidebar->row_actions);
#ifdef HAVE_CLOUDPROVIDERS
g_clear_object (&sidebar->cloud_manager);
#endif
g_clear_pointer (&sidebar->swin, gtk_widget_unparent);
G_OBJECT_CLASS (gtk_places_sidebar_parent_class)->finalize (object);