[nautilus/wip/oholy/pathbar-crash-fix] pathbar: Disconnect signals when disposing to avoid crashes




commit 4290f674db2d4e1b5827ff30a65d517854fe655d
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: GNOME/nautilus#2192

 src/nautilus-pathbar.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 4dea6168f..f8a91aba9 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -131,6 +131,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[] =
 {
@@ -309,7 +310,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);
@@ -332,6 +332,8 @@ remove_settings_signal (NautilusPathBar *self,
     settings = gtk_settings_get_for_screen (screen);
 
     g_clear_signal_handler (&self->settings_signal_id, settings);
+
+    nautilus_path_bar_clear_buttons (self);
 }
 
 static void
@@ -543,7 +545,6 @@ nautilus_path_bar_clear_buttons (NautilusPathBar *self)
         ButtonData *button_data;
 
         button_data = BUTTON_DATA (self->button_list->data);
-
         gtk_box_remove (GTK_BOX (self->buttons_box), button_data->container);
 
         self->button_list = g_list_remove (self->button_list, button_data);


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