[gimp/wip/Jehan/layers-dockable-refresh: 82/105] app: fix critical when filtering items in Palette dockable.




commit 496bfe6618ea12ece756d0e001e0cd9aa74217c0
Author: Jehan <jehan girinstud io>
Date:   Sat Oct 23 00:56:41 2021 +0200

    app: fix critical when filtering items in Palette dockable.
    
    An item with no path is actually not always a bug. It can very well be
    normal if the tree view has a filtering logics where some items which
    were selected suddenly get hidden.

 app/widgets/gimpcontainertreeview.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/app/widgets/gimpcontainertreeview.c b/app/widgets/gimpcontainertreeview.c
index d4f824787c..88085cf38c 100644
--- a/app/widgets/gimpcontainertreeview.c
+++ b/app/widgets/gimpcontainertreeview.c
@@ -885,13 +885,14 @@ gimp_container_tree_view_select_items (GimpContainerView *view,
         {
           GtkTreePath *path;
           path = gimp_container_tree_view_get_path (tree_view, item->data);
-          if (path == NULL)
-            {
-              g_critical ("%s: item %s has no path!\n",
-                          G_STRFUNC, gimp_object_get_name (GIMP_OBJECT (item->data)));
-              return FALSE;
-            }
-          paths = g_list_prepend (paths, path);
+          if (path != NULL)
+            /* It may happen that some items have no paths when a tree
+             * view has some filtering logics (for instance Palette or
+             * Fonts dockables). Then an item which was selected at
+             * first might become unselected during filtering and has to
+             * be removed from selection.
+             */
+            paths = g_list_prepend (paths, path);
         }
 
       paths = g_list_reverse (paths);


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