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




commit aca3d852c64542241c0e2b9c3ed3dbbac2eb71b7
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]