summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2010-09-17 20:23:34 +0200
committerCosimo Cecchi <cosimoc@gnome.org>2010-09-20 14:52:16 +0200
commitc92674ae26f149ea446c1d6f9f024d22218463e8 (patch)
treee8a0cd17cde9491b9a4806ae03f8ef9ba1c42cb0
parent1cf2616fc04aabb1dfed79f499d0387528876132 (diff)
downloadnautilus-c92674ae26f149ea446c1d6f9f024d22218463e8.tar.gz
pathbar: use another way to remove buttons (#627901)
This fixes a crasher in _size_allocate() where the list of buttons did not contain valid data anymore.
-rw-r--r--src/nautilus-pathbar.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 3d646883a..a9e7adcce 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -1509,7 +1509,7 @@ button_data_file_changed (NautilusFile *file,
ButtonData *button_data)
{
GFile *location, *current_location, *parent, *button_parent;
- ButtonData *current_button_data, *temp_button_data;
+ ButtonData *current_button_data;
char *display_name;
NautilusPathBar *path_bar;
gboolean renamed, child;
@@ -1569,18 +1569,17 @@ button_data_file_changed (NautilusFile *file,
return;
}
} else if (nautilus_file_is_gone (file)) {
- /* remove this and the following buttons */
- GList *children;
-
- children = g_list_find (path_bar->button_list, button_data);
-
- while (children != NULL) {
- temp_button_data = children->data;
+ gint idx, position;
- /* children are in reverse order */
- children = children->prev;
+ /* remove this and the following buttons */
+ position = g_list_position (path_bar->button_list,
+ g_list_find (path_bar->button_list, button_data));
- gtk_container_remove (GTK_CONTAINER (path_bar), temp_button_data->button);
+ if (position != -1) {
+ for (idx = 0; idx <= position; idx++) {
+ gtk_container_remove (GTK_CONTAINER (path_bar),
+ BUTTON_DATA (path_bar->button_list->data)->button);
+ }
}
g_object_unref (location);