1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

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.
This commit is contained in:
reuk 2022-09-28 14:38:53 +01:00
parent 57d291588c
commit 00b1bf3f5b
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11

View file

@ -202,33 +202,27 @@ int DirectoryContentsList::useTimeSlice()
bool DirectoryContentsList::checkNextFile (bool& hasChanged)
{
if (fileFindHandle != nullptr)
if (fileFindHandle == nullptr)
return false;
if (*fileFindHandle == RangedDirectoryIterator())
{
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;
}
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,