[Xfce4-commits] [xfce/thunar] 01/01: Stuck tree pane makes Thunar use 100% CPU (bug #10161)

noreply at xfce.org noreply at xfce.org
Wed Jan 16 22:24:47 CET 2019


This is an automated email from the git hooks/post-receive script.

a   l   e   x       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       x   f   c   e   -   4   .   1   4   
   in repository xfce/thunar.

commit cdd2be21a0b18390186343d6e354fcf78511bf16
Author: Alexander Schwinn <alexxcons at xfce.org>
Date:   Tue Jan 15 23:20:34 2019 +0100

    Stuck tree pane makes Thunar use 100% CPU
    (bug #10161)
    
    Followup fix of #14900
    - added missing NULL checks
    - added missing unref calls on ThunarFiles
    - fixed logic for file-system root
---
 thunar/thunar-tree-view.c | 35 +++++++++++++++++++++++++++--------
 1 file changed, 27 insertions(+), 8 deletions(-)

diff --git a/thunar/thunar-tree-view.c b/thunar/thunar-tree-view.c
index 1241bcf..3ac367e 100644
--- a/thunar/thunar-tree-view.c
+++ b/thunar/thunar-tree-view.c
@@ -2501,6 +2501,8 @@ thunar_tree_view_cursor_idle (gpointer user_data)
   GtkTreePath    *path;
   GtkTreeIter     iter;
   ThunarFile     *file;
+  ThunarFile     *parent;
+  GFileInfo      *parent_info;
   GtkTreeIter     child_iter;
   ThunarFile     *file_in_tree;
   gboolean        done = TRUE;
@@ -2549,18 +2551,28 @@ THUNAR_THREADS_ENTER
           break;
         }
 
-      /* initialize child_iter */
+      /* Try to create missing children if there are none (this as well initializes child_iter if there are children) */
       if (!gtk_tree_model_iter_children (GTK_TREE_MODEL (view->model), &child_iter, &iter))
         {
-          /* E.g. folders for which we dont have read permission dont have any child in the tree */
-          /* Make sure that missing read permissions are the problem */
-          if (!g_file_info_get_attribute_boolean (thunar_file_get_info (thunar_file_get_parent (file, NULL)), G_FILE_ATTRIBUTE_ACCESS_CAN_READ))
+          done = FALSE;
+          parent = thunar_file_get_parent (file, NULL);
+          if (parent == NULL) /* e.g root has no parent .. skip it */
+            continue;
+
+          parent_info = thunar_file_get_info (parent);
+          if (parent_info != NULL)
             {
-              /* We know that there is a File. Lets just create the required tree-node */
-              thunar_tree_model_add_child (view->model, iter.user_data, file);
-              done = FALSE;
+              /* E.g. folders for which we do not have read permission dont have any child in the tree */
+              /* Make sure that missing read permissions are the problem */
+              if (!g_file_info_get_attribute_boolean (parent_info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ))
+                {
+                  /* We KNOW that there is a File. Lets just create the required tree-node */
+                  thunar_tree_model_add_child (view->model, iter.user_data, file);
+                }
             }
-          break;
+          g_object_unref (parent);
+          break; /* we dont have a valid child_iter by now, so we cannot continue.                         */
+                 /* Since done is FALSE, the next iteration on thunar_tree_view_cursor_idle will go deeper */
         }
 
       /* loop on children to see if any folder matches  */
@@ -2585,6 +2597,13 @@ THUNAR_THREADS_ENTER
         }
     }
 
+  /* tidy up */
+  for (lp = path_as_list; lp != NULL; lp = lp->next)
+    {
+      file = THUNAR_FILE (lp->data);
+      if (file != NULL && file != view->current_directory)
+        g_object_unref (file);
+    }
   g_list_free (path_as_list);
 
 THUNAR_THREADS_LEAVE

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list