summarylogtreecommitdiffstats
path: root/0001-gtkplacessidebar-Disconnect-and-unref-cloud_manager-.patch
blob: 9e3d21843c515666757f1ab6473727f64b526411 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Tue, 6 Oct 2020 21:14:45 +0000
Subject: [PATCH] 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,32 +4411,32 @@ 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);
 }
 
 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);
 }