Thunar crash in thunar-tree-view-model.c clicking inaccessible mount in left pane tree
This is a very straightforward issue, I am using Thunar 4.19.0 on stable Gentoo,
Experiencing a big crash after clicking a bookmark in left side tree view:
(note the screenshot was taken after my patch was applied or I would not have been able to click into this dir)
Clicking a mounted directory in the left-pane tree view that I have bookmarked, but I don't have permission to access now (local mount permission error, or SELinux access denied)
= (the ones marked with an X or a Lock), turns an otherwise perfectly working thunar, into a hard crash immediately.
Unpacking the core dump with GDB, we find a backtrace of, GDB backtrace thunar-gdb.txt:
#0 0x00000c5a97cb60c2 in thunar_tree_view_model_dir_remove_file (node=0x0, file=0x651a00061720) at thunar-tree-view-model.c:2250
#1 0x00000c5a97cb82ef in _thunar_tree_view_model_folder_error (node=0xc5ad1521290, error=0x651a08082f80) at thunar-tree-view-model.c:2463
Thats it. Thats the entire trace. The entire defect is contained in 1 line of this file, line 2462:
When the node->parent is NULL , the else case is wrongly being triggered !
I have already devised a patch, my patch submitted to fix thunar-bookmarks-left-pane-crashfix.patch
listed below:
+++ thunar-4.19.0/thunar/thunar-tree-view-model.c 2023-11-26 16:04:00.760592767 -0500
@@ -2462,7 +2462,7 @@
- else
+ else if (node->parent && node->n_children > 0)
The fix would involve refactoring these if/else checks, such as shown, particularly - making sure node parent is still not NULL for the else case.
(just an "else if (node->parent != NULL)" is enough to fix it, not too sure about the children, or preferred way to check it, (im new so not entirely sure on the internals of Thunar).
but as is, This is a defect. I believe I hit this issue so easily because I am doing more access control than the average bear.
I have shown you something here that can help improve Thunar, hopefully someone can help push the fix back upstream. Thank you!