[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:13:17 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 m a s t e r
in repository xfce/thunar.
commit 606c114a2508a378f2188f6a452e7d5cac948af8
Author: Alexander Schwinn <acs82 at gmx.de>
Date: Mon Feb 12 00:10:03 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 8d61bf0..e8a36cc 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -2852,25 +2852,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