1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

Fix calling FileListComponent::setSelectedFile after DirectoryContentsList::setDirectory

Prior to this fix calling setDirectory and then setSelectedFile from the
same call stack could cause setSelectedFile to have no effect. This was
because the directory change is asynchronously propagated from the
DirectoryContentsList. This was picked up by the FileListComponent as a
directory change after setSelectedFile, even though the directory change
happened before.
This commit is contained in:
attila 2025-08-12 16:21:33 +02:00 committed by Attila Szarvas
parent b272f968aa
commit b95ede49ff

View file

@ -72,6 +72,8 @@ void FileListComponent::scrollToTop()
void FileListComponent::setSelectedFile (const File& f)
{
lastDirectory = directoryContentsList.getDirectory();
if (! directoryContentsList.isStillLoading())
{
for (int i = directoryContentsList.getNumFiles(); --i >= 0;)