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.
This commit is contained in:
Ell 2018-02-11 08:45:07 -05:00
parent bd9c569e21
commit 7bfab7150c
1 changed files with 13 additions and 1 deletions

View File

@ -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;