[PATCH] Prevent multiple 'Failed to open directory' windows
See attached patch. Will open a proper MR if you give me permissions.
In this scenario, multiple 'Failed to open directory' error windows appear:
- Navigate to a directory you can't usually access, such as '/root'
- A 'Failed to open directory' error window appears. Don't close it
- Copy some text to the clipboard from another application
- Another 'Failed to open directory' error window appears
- Repeat step 3 and 4 to open even more 'Failed to open directory' windows
If the error window from step 2 is closed, then copying text to the clipboard won't open any other 'Failed to open directory' windows.
What's happening behind the scenes is that copying text to the clipboard reloads the Thunar window (see thunar_window_clipboard_manager_changed
), which causes it to reload the current directory.
When the directory is inaccessible, the directory in ThunarListModel
is supposed to be NULL
. However, the code in thunar_list_model_folder_error
which runs on an access error, doesn't set the folder to NULL
until the error window is closed. Thus, when the clipboard event reloads the directory while the error window is still open, access fails again and another error appears.
To fix this, we simply set the folder to NULL
before showing the error. (The handler in thunar_standard_view_error
doesn't use it)
PS: On Wayland/Sway, the clipboard owner-changed
event triggers on focus (not sure if this is a bug or expected behaviour), so simply running steps 1 and 2 will trigger an infinite loop of 'Failed to open directory' error windows.
Bonus video demo: ThunarAccessMultipleErrorWindowBugDemo.mkv
0001-Avoid-many-Failed-to-open-directory-windows-Issue-660.patch