[gtk/gtk-3-24: 1/2] gtkplacessidebar: Disconnect and unref cloud_manager in dispose
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 1/2] gtkplacessidebar: Disconnect and unref cloud_manager in dispose
- Date: Tue, 6 Oct 2020 22:29:40 +0000 (UTC)
commit d3d9788d716ab34a0eec736ab09c553c8ae5bf48
Author: Jan Alexander Steffens (heftig) <jan steffens gmail com>
Date: Tue Oct 6 21:14:45 2020 +0000
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
gtk/gtkplacessidebar.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 87c08a5389..118739fdd2 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -4411,17 +4411,24 @@ gtk_places_sidebar_dispose (GObject *object)
sidebar->shortcuts = NULL;
#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);
@@ -4430,13 +4437,6 @@ gtk_places_sidebar_dispose (GObject *object)
static void
gtk_places_sidebar_finalize (GObject *object)
{
-#ifdef HAVE_CLOUDPROVIDERS
- GtkPlacesSidebar *sidebar;
-
- sidebar = GTK_PLACES_SIDEBAR (object);
- g_clear_object (&sidebar->cloud_manager);
-#endif
-
G_OBJECT_CLASS (gtk_places_sidebar_parent_class)->finalize (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]