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




commit be58480dd23ed417dc283d59f03e395d41479e12
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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 4dea6168f..04420474b 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);
@@ -342,6 +342,7 @@ nautilus_path_bar_dispose (GObject *object)
     self = NAUTILUS_PATH_BAR (object);
 
     remove_settings_signal (self, gtk_widget_get_screen (GTK_WIDGET (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]