> thunar_file_compare_by_name() function is called even for only one file in
> working directory - both file_a->collate_key_nocase and
> file_b->collate_key_nocase are NULL. I noticed that sometimes this function
> is not called, but when it is (it is random), then it crashes.
This patch will keep thunar_file_compare_by_name() from crashing when the collate keys are NULL. When using this patch, users may notice a random occurance of 2 files appearing selected together with the same name. The cause of this random occurance may be a result of the underlying issue after 'successful' sorting.
/* case insensitive checking */
if (G_LIKELY (!case_sensitive))
- result = strcmp (file_a->collate_key_nocase, file_b->collate_key_nocase);
+ result = g_strcmp0 (file_a->collate_key_nocase, file_b->collate_key_nocase);
/* fall-back to case sensitive */
if (result == 0)
- result = strcmp (file_a->collate_key, file_b->collate_key);
+ result = g_strcmp0 (file_a->collate_key, file_b->collate_key);
(In reply to Jan Havran from comment #0)
> thunar_ file_compare_ by_name( ) function is called even for only one file in >collate_ key_nocase and >collate_ key_nocase are NULL. I noticed that sometimes this function
> working directory - both file_a-
> file_b-
> is not called, but when it is (it is random), then it crashes.
This patch will keep thunar_ file_compare_ by_name( ) from crashing when the collate keys are NULL. When using this patch, users may notice a random occurance of 2 files appearing selected together with the same name. The cause of this random occurance may be a result of the underlying issue after 'successful' sorting.
diff -Naurp Thunar- 1.6.10/ thunar/ thunar- file.c Thunar- 1.6.10- fix/thunar/ thunar- file.c 1.6.10/ thunar/ thunar- file.c 2015-05-22 13:25:36.000000000 +0000 1.6.10- fix/thunar/ thunar- file.c 2016-08-04 17:41:14.330000001 +0000 file_compare_ by_name (const Thuna
--- Thunar-
+++ Thunar-
@@ -4020,11 +4020,11 @@ thunar_
/* case insensitive checking */ >collate_ key_nocase, file_b- >collate_ key_nocase) ; >collate_ key_nocase, file_b- >collate_ key_nocase) ;
if (G_LIKELY (!case_sensitive))
- result = strcmp (file_a-
+ result = g_strcmp0 (file_a-
/* fall-back to case sensitive */ >collate_ key, file_b- >collate_ key); >collate_ key, file_b- >collate_ key);
if (result == 0)
- result = strcmp (file_a-
+ result = g_strcmp0 (file_a-
/* this happens in the trash */
if (result == 0)