From 7bfab7150c8d304bf8a85e2162b36d6256cae4f0 Mon Sep 17 00:00:00 2001 From: Ell Date: Sun, 11 Feb 2018 08:45:07 -0500 Subject: [PATCH] Bug 792991 - Crash when undoing a paste while naming pasted layer When removing a GimpContainerTreeStore item, make sure that editing of corresponding tree-view rows is canceled first, by emitting a "row-changed" signal. Otherwise, we can run into trouble when removing an item that is being edited. --- app/widgets/gimpcontainertreestore.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/widgets/gimpcontainertreestore.c b/app/widgets/gimpcontainertreestore.c index 2280e95ade..be22d6d448 100644 --- a/app/widgets/gimpcontainertreestore.c +++ b/app/widgets/gimpcontainertreestore.c @@ -300,13 +300,25 @@ gimp_container_tree_store_remove_item (GimpContainerTreeStore *store, { if (iter) { + GtkTreeModel *model = GTK_TREE_MODEL (store); + GtkTreePath *path; + + /* emit a "row-changed" signal for 'iter', so that editing of + * corresponding tree-view rows is canceled. otherwise, if we remove the + * item while a corresponding row is being edited, bad things happen (see + * bug #792991). + */ + path = gtk_tree_model_get_path (model, iter); + gtk_tree_model_row_changed (model, path, iter); + gtk_tree_path_free (path); + gtk_tree_store_remove (GTK_TREE_STORE (store), iter); /* If the store is empty after this remove, clear out renderers * from all cells so they don't keep refing the viewables * (see bug #149906). */ - if (! gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL)) + if (! gtk_tree_model_iter_n_children (model, NULL)) { GimpContainerTreeStorePrivate *private = GET_PRIVATE (store); GList *list;