[gimp] Bug 792991 - Crash when undoing a paste while naming pasted layer



commit 7bfab7150c8d304bf8a85e2162b36d6256cae4f0
Author: Ell <ell_se yahoo com>
Date:   Sun Feb 11 08:45:07 2018 -0500

    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 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/app/widgets/gimpcontainertreestore.c b/app/widgets/gimpcontainertreestore.c
index 2280e95..be22d6d 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;


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