[nautilus] pathbar: Disconnect signals when disposing to avoid crashes



commit ae54e48ec712b65448afb4efdd2adf7c904dc2e7
Author: Ondrej Holy <oholy redhat com>
Date:   Fri Mar 18 14:48:10 2022 +0100

    pathbar: Disconnect signals when disposing to avoid crashes
    
    The path bar buttons are updated when the corresponding files are changed.
    Unfortunately, the "changed" signals are not disconnected when destroying the
    path bar. This can lead to crashes. Let's explicitly disconnect the signals
    when disposing of the buttons.
    
    Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2192

 src/nautilus-pathbar.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 644fc9d0e..ce7c6fee1 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -124,6 +124,7 @@ static void     action_pathbar_properties (GSimpleAction *action,
                                            gpointer       user_data);
 static void     pop_up_pathbar_context_menu (NautilusPathBar *self,
                                              NautilusFile    *file);
+static void nautilus_path_bar_clear_buttons (NautilusPathBar *self);
 
 const GActionEntry path_bar_actions[] =
 {
@@ -300,7 +301,6 @@ nautilus_path_bar_finalize (GObject *object)
 
     self = NAUTILUS_PATH_BAR (object);
 
-    g_list_free (self->button_list);
     g_clear_object (&self->current_view_menu);
     g_clear_object (&self->extensions_section);
     g_clear_object (&self->templates_submenu);
@@ -316,6 +316,10 @@ nautilus_path_bar_finalize (GObject *object)
 static void
 nautilus_path_bar_dispose (GObject *object)
 {
+    NautilusPathBar *self = NAUTILUS_PATH_BAR (object);
+
+    nautilus_path_bar_clear_buttons (self);
+
     G_OBJECT_CLASS (nautilus_path_bar_parent_class)->dispose (object);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]