Index: thunar/thunar-standard-view.c =================================================================== --- thunar/thunar-standard-view.c (revision 18964) +++ thunar/thunar-standard-view.c (working copy) @@ -2136,12 +2136,11 @@ const gchar *text, ThunarStandardView *standard_view) { - GtkTreeRowReference *row; - const gchar *old_name; - GtkTreePath *path; - GtkTreeIter iter; - ThunarFile *file; - GError *error = NULL; + const gchar *old_name; + GtkTreePath *path; + GtkTreeIter iter; + ThunarFile *file; + GError *error = NULL; g_return_if_fail (THUNAR_IS_TEXT_RENDERER (text_renderer)); g_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view)); @@ -2154,7 +2153,11 @@ /* determine path and iterator for the edited item */ path = gtk_tree_path_new_from_string (path_string); gtk_tree_model_get_iter (GTK_TREE_MODEL (standard_view->model), &iter, path); + gtk_tree_path_free (path); + /* this will only work if we have persistent iterators, so let's make sure we don't forget that! */ + g_assert (gtk_tree_model_get_flags (GTK_TREE_MODEL (standard_view->model)) & GTK_TREE_MODEL_ITERS_PERSIST); + /* determine the file from the iter */ file = thunar_list_model_get_file (THUNAR_LIST_MODEL (standard_view->model), &iter); @@ -2162,12 +2165,6 @@ old_name = thunar_file_get_display_name (file); if (G_LIKELY (!exo_str_is_equal (old_name, text))) { - /* remember a row reference to the file as the - * rename operation is likely cause a reordering - * of the list model. - */ - row = gtk_tree_row_reference_new (GTK_TREE_MODEL (standard_view->model), path); - /* try to rename the file */ if (!thunar_file_rename (file, text, &error)) { @@ -2177,26 +2174,26 @@ /* release the error */ g_error_free (error); } - else if (G_LIKELY (gtk_tree_row_reference_valid (row))) + else { - /* place the cursor on the item again and scroll to the position */ - path = gtk_tree_row_reference_get_path (row); - (*THUNAR_STANDARD_VIEW_GET_CLASS (standard_view)->scroll_to_path) (standard_view, path); - gtk_tree_path_free (path); + /* determine the path from the persistent(!) iterator again */ + path = gtk_tree_model_get_path (GTK_TREE_MODEL (standard_view->model), &iter); + if (G_LIKELY (path != NULL)) + { + /* place the cursor on the item again and scroll to the position */ + (*THUNAR_STANDARD_VIEW_GET_CLASS (standard_view)->scroll_to_path) (standard_view, path); + gtk_tree_path_free (path); - /* update the selection, so we get updated actions, statusbar, - * etc. with the new file name and probably new mime type. - */ - thunar_standard_view_selection_changed (standard_view); + /* update the selection, so we get updated actions, statusbar, + * etc. with the new file name and probably new mime type. + */ + thunar_standard_view_selection_changed (standard_view); + } } - - /* release the row reference */ - gtk_tree_row_reference_free (row); } /* cleanup */ g_object_unref (G_OBJECT (file)); - gtk_tree_path_free (path); }