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



commit 4683d0140af87e4e2a95670b52d14e0eb79186fa
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 d111ae28b2..619e3a9ebd 100644
--- a/app/widgets/gimpcontainertreeview.c
+++ b/app/widgets/gimpcontainertreeview.c
@@ -923,13 +923,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]