Browse Source

DirectoryContentsList: Ensure change notification is sent after search completes

This fixes an issue where the FileListComponent might fail to select a
file, because the file list reported that it was still loading during
the final ChangeListener callback.
v7.0.9
reuk 2 years ago
parent
commit
00b1bf3f5b
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
1 changed files with 16 additions and 22 deletions
  1. +16
    -22
      modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp

+ 16
- 22
modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp View File

@@ -202,33 +202,27 @@ int DirectoryContentsList::useTimeSlice()
bool DirectoryContentsList::checkNextFile (bool& hasChanged)
{
if (fileFindHandle != nullptr)
{
if (*fileFindHandle != RangedDirectoryIterator())
{
const auto entry = *(*fileFindHandle)++;
if (addFile (entry.getFile(),
entry.isDirectory(),
entry.getFileSize(),
entry.getModificationTime(),
entry.getCreationTime(),
entry.isReadOnly()))
{
hasChanged = true;
}
return true;
}
if (fileFindHandle == nullptr)
return false;
if (*fileFindHandle == RangedDirectoryIterator())
{
fileFindHandle = nullptr;
isSearching = false;
if (! wasEmpty && files.isEmpty())
hasChanged = true;
hasChanged = true;
return false;
}
return false;
const auto entry = *(*fileFindHandle)++;
hasChanged |= addFile (entry.getFile(),
entry.isDirectory(),
entry.getFileSize(),
entry.getModificationTime(),
entry.getCreationTime(),
entry.isReadOnly());
return true;
}
bool DirectoryContentsList::addFile (const File& file, const bool isDir,


Loading…
Cancel
Save