GtkFileSystemModel races between CREATE and DELETE events
@bberg
Submitted by Benjamin Berg Link to original bug (#781848)
Description
If a CREATE(/CHANGED) and DELETE event happen within a very short time then there is a race condition. The issue is that in response to the first event g_file_query_info_async is called which may take longer to resolve the information than a later DELETE event. This means that no file exists that can be removed from the model or alternatively that the file is re-added again right after it has been removed.
To solve this we will need to:
- Keep track of all active async information querying for each file
- Cancel these in response to a delete or store the delete to ignore the result when it arrives.
This issue can be easily reproduced when opening the file chooser in gedit and then opening a file in the same folder in gedit itself. You need to show hidden files obviously:
- Open gedit
- Open a file in any folder (that can be saved)
- Open the file chooser in the same folder
- Enable "Show hidden files"
- Save the previously opened file a couple of times (keep file chooser open)
Result: A lot of .goutputstream-XXXXX files will show up as they are not properly removed from the model again after the final rename to the target file.