Hey everyone, I found this bug while working on improving the behavior of 'alt-up' (the patch is coming soon!) This patch fixes a race condition in FMDirectoryView that causes an item in list view to sometimes not to be selected in its parent window when using 'alt-up' in a Nautilus navigator window. Without the patch, this happens: 1. Open up a navigator window to '/home' and set it to 'List View'. 2. Close the window. 3. Re-launch Nautilus either by logging out and logging back in, or by typing 'nautilus --quit' in a terminal. 4. Open up a navigator window to your home directory 5. Now press 'alt-up' to go to the '/home' directory Expected result: your home folder should be selected in the window Actual result: your home folder is not selected Now, press the 'Back' button to go back to your home folder, and then press 'alt-up' again to go back to the '/home' folder. This time, and all subsequent times until you restart Nautilus, your home folder *is* selected. I found that when doing an 'alt-up' into the /home folder for the first time, and the /home folder is in list view, FMDirectoryView's selection_changed_callback would get called *before* finish_loading() had a chance to set FMDirectoryView->FMDirectoryViewDetails->loading to TRUE. Since 'loading' was false, selection_changed_callback tried to immediately set the selection of the view, causing us to lose the selection. On subsequent uses of 'alt-up' however, selection_changed_callback occurs *after* the call to finish_loading(). My guess is that this has to do with differences in the length of time to load all file information and prepare the view in list view compared to icon view, and it might also have to do with the length of time for loading a directory not in the $HOME filesystem subtree (this bug shows itself if you open any non-$HOME directory such as /usr/local for the first time). The fix was to set 'loading' to TRUE sooner, in load_directory(), so that it will be TRUE when selection_changed_callback() runs. I also removed unnecessary setting of FMDirectoryView->FMDirectoryDetails->loading in FMIconView. Sorry for being so long-winded. Please let me know if I should cut down on the information! :) Let me know if anything needs to be clarified. Thanks! Jimmy
Attachment:
fm-directory-view-loading.patch
Description: Binary data