[Xfce-bugs] [Bug 12264] Crash when renaming single file in folder
bugzilla-daemon at xfce.org
bugzilla-daemon at xfce.org
Fri Jan 27 16:32:52 CET 2017
https://bugzilla.xfce.org/show_bug.cgi?id=12264
--- Comment #155 from pgkos.bugzilla at yahoo.com ---
I am sending a simple patch which wraps the renaming code and the folder
monitor code in a mutex.
I suppose that the main reason for the crash is that when we call in
thunar-file.c:1932:
g_file_set_display_name (file->gfile, name, cancellable, error);
this call sends a signal which is connected to the folder monitor. The folder
monitor runs on another thread. The thunar_folder_monitor function gets called
immediately and it sends some signals which call thunar_list_model_files_added,
which then uses thunar_file_compare_by_name as comparison function.
The problem is, we have our original, "renaming" thread, which at one point
calls thunar_file_info_clear. If we are at the end of this clearing function
and then the thread switches and the code from thunar_file_compare_by_name
continues, it will segfault because all members of ThunarFile structure are now
null.
The solution is to prevent starting the code of thunar_folder_monitor until the
renaming procedure is completed so all ThunarFile members are already updated.
So, I have added an extern "rename" mutex which is acquired in these two
functions.
The mutex must be acquired before the call to g_file_set_display_name.
Also, there is a simple method to trigger the segfault:
- add a 1-second sleep as the last line of the thunar_file_info_clear function
- add a 0.5-second sleep as the first line of the thunar_folder_monitor
(you can add some conditional checks to prevent long pause when loading Thunar)
- compile and test
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Xfce-bugs
mailing list