[gtk/matthiasc/for-master] gtkplacessidebar: Disconnect and unref cloud_manager in dispose
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master] gtkplacessidebar: Disconnect and unref cloud_manager in dispose
- Date: Wed, 7 Oct 2020 02:35:18 +0000 (UTC)
commit 8802e306cbc482ad9bab6b388b62e1b791de857a
Author: Jan Alexander Steffens (heftig) <jan steffens gmail com>
Date: Tue Oct 6 22:34:11 2020 -0400
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 | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index a6124cc800..4a936bf5b4 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]