[gimp/gimp-2-10] Issue #3284 - Wrong layer renamed when switching images



commit 95ea4e4272f9f081bddc04892aab2559ab22dc02
Author: Ell <ell_se yahoo com>
Date:   Sun Apr 21 09:59:24 2019 -0400

    Issue #3284 - Wrong layer renamed when switching images
    
    In gimp_container_tree_view_clear_items(), temporarily unset the
    tree-view's model before clearing it, so that name editing is
    stopped beforehand.  Otherwise, name editing is stopped once the
    corresponding item is removed from the store, causing us to rename
    the wrong item.
    
    (cherry picked from commit bb8648a2e9e9c10c69e5e7983f545413b2f6edc8)

 app/widgets/gimpcontainertreeview.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/app/widgets/gimpcontainertreeview.c b/app/widgets/gimpcontainertreeview.c
index e4dcd64da0..8b698a41f7 100644
--- a/app/widgets/gimpcontainertreeview.c
+++ b/app/widgets/gimpcontainertreeview.c
@@ -926,8 +926,25 @@ gimp_container_tree_view_clear_items (GimpContainerView *view)
 {
   GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
 
+  g_signal_handlers_block_by_func (tree_view->priv->selection,
+                                   gimp_container_tree_view_selection_changed,
+                                   tree_view);
+
+  /* temporarily unset the tree-view's model, so that name editing is stopped
+   * now, before clearing the tree store.  otherwise, name editing would stop
+   * when the corresponding item is removed from the store, leading us to
+   * rename the wrong item.  see issue #3284.
+   */
+  gtk_tree_view_set_model (tree_view->view, NULL);
+
   gimp_container_tree_store_clear_items (GIMP_CONTAINER_TREE_STORE (tree_view->model));
 
+  gtk_tree_view_set_model (tree_view->view, tree_view->model);
+
+  g_signal_handlers_unblock_by_func (tree_view->priv->selection,
+                                     gimp_container_tree_view_selection_changed,
+                                     tree_view);
+
   parent_view_iface->clear_items (view);
 }
 


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