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.
This commit is contained in:
Ell 2019-04-21 09:59:24 -04:00
parent fb0b4330e4
commit bb8648a2e9
1 changed files with 9 additions and 3 deletions

View File

@ -919,15 +919,21 @@ gimp_container_tree_view_clear_items (GimpContainerView *view)
{
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
/* GTK+ 3.x always keeps the row with the cursor selected, so we get
* a gazillion selection changed during gtk_tree_store_clear()
*/
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);