[nautilus/wip/ernestask/691-et-al] pathbar: Clear button data in GtkContainer::remove
- From: Ernestas Kulik <ernestask src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/ernestask/691-et-al] pathbar: Clear button data in GtkContainer::remove
- Date: Sun, 14 Oct 2018 16:51:51 +0000 (UTC)
commit f6d6199c19e8eecffba32825ed106545e01fac24
Author: Ernestas Kulik <ernestask gnome org>
Date: Sun Oct 14 19:44:07 2018 +0300
pathbar: Clear button data in GtkContainer::remove
After a40f2b5415b2d919be28bf19e29c4ea840f87685, the button data is only
removed when button_data_free() gets called explicitly, which only
happens in two places: nautilus_path_bar_clear_buttons() and
button_data_file_changed(). What also happens is that buttons are
removed as part of their containing container destruction, which was
accounted for when a weak ref was used. Now that that never happens,
some leftover signal handlers wreak havoc.
Fixes https://gitlab.gnome.org/GNOME/nautilus/issues/691
src/nautilus-pathbar.c | 41 +++++++++++++++++++----------------------
1 file changed, 19 insertions(+), 22 deletions(-)
---
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 54698ef90..2a7bdc42e 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -724,6 +724,24 @@ nautilus_path_bar_remove_1 (GtkContainer *container,
}
}
+static void
+button_data_free (ButtonData *button_data)
+{
+ g_object_unref (button_data->path);
+ g_free (button_data->dir_name);
+ if (button_data->file != NULL)
+ {
+ g_signal_handler_disconnect (button_data->file,
+ button_data->file_changed_signal_id);
+ nautilus_file_monitor_remove (button_data->file, button_data);
+ nautilus_file_unref (button_data->file);
+ }
+
+ g_clear_object (&button_data->multi_press_gesture);
+
+ g_free (button_data);
+}
+
static void
nautilus_path_bar_remove (GtkContainer *container,
GtkWidget *widget)
@@ -740,6 +758,7 @@ nautilus_path_bar_remove (GtkContainer *container,
{
nautilus_path_bar_remove_1 (container, widget);
self->button_list = g_list_remove_link (self->button_list, children);
+ button_data_free (children->data);
g_list_free_1 (children);
return;
}
@@ -1012,24 +1031,6 @@ nautilus_path_bar_check_icon_theme (NautilusPathBar *self)
reload_icons (self);
}
-static void
-button_data_free (ButtonData *button_data)
-{
- g_object_unref (button_data->path);
- g_free (button_data->dir_name);
- if (button_data->file != NULL)
- {
- g_signal_handler_disconnect (button_data->file,
- button_data->file_changed_signal_id);
- nautilus_file_monitor_remove (button_data->file, button_data);
- nautilus_file_unref (button_data->file);
- }
-
- g_clear_object (&button_data->multi_press_gesture);
-
- g_free (button_data);
-}
-
/* Public functions and their helpers */
static void
nautilus_path_bar_clear_buttons (NautilusPathBar *self)
@@ -1041,8 +1042,6 @@ nautilus_path_bar_clear_buttons (NautilusPathBar *self)
button_data = BUTTON_DATA (self->button_list->data);
gtk_container_remove (GTK_CONTAINER (self), button_data->container);
-
- button_data_free (button_data);
}
}
@@ -1521,8 +1520,6 @@ button_data_file_changed (NautilusFile *file,
data = BUTTON_DATA (self->button_list->data);
gtk_container_remove (GTK_CONTAINER (self), data->container);
-
- button_data_free (data);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]