[Xfce4-commits] [xfce/thunar] 01/01: Crash in thunar_file_is_gfile_ancestor (bug #14202)

noreply at xfce.org noreply at xfce.org
Mon Feb 12 00:30:01 CET 2018


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   2   
   in repository xfce/thunar.

commit 2da1b2afd197d65be07560c6db35cc27686090e7
Author: Alexander Schwinn <acs82 at gmx.de>
Date:   Mon Feb 12 00:27:41 2018 +0100

    Crash in thunar_file_is_gfile_ancestor (bug #14202)
---
 thunar/thunar-file.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index 46d0dc7..f70e5ad 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -2809,25 +2809,31 @@ gboolean
 thunar_file_is_gfile_ancestor (const ThunarFile *file,
                                GFile            *ancestor)
 {
-  gboolean is_ancestor = FALSE;
   GFile   *current = NULL;
   GFile   *tmp;
 
   _thunar_return_val_if_fail (THUNAR_IS_FILE (file), FALSE);
+  _thunar_return_val_if_fail (G_IS_FILE (file->gfile), FALSE);
   _thunar_return_val_if_fail (G_IS_FILE (ancestor), FALSE);
 
-  for (current = g_object_ref (file->gfile);
-       is_ancestor == FALSE && current != NULL;
-       tmp = g_file_get_parent (current), g_object_unref (current), current = tmp)
+  current = g_object_ref (file->gfile);
+  while(TRUE)
     {
+      tmp = g_file_get_parent (current);
+      g_object_unref (current);
+      current = tmp;
+
+      if (current == NULL) /* parent of root is NULL */
+        return FALSE;
+
       if (G_UNLIKELY (g_file_equal (current, ancestor)))
-        is_ancestor = TRUE;
+        {
+          g_object_unref (current);
+          return TRUE;
+        }
     }
 
-  if (current != NULL)
-    g_object_unref (current);
-
-  return is_ancestor;
+  return FALSE;
 }
 
 

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


More information about the Xfce4-commits mailing list