mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
DirectoryContentsList: Start thread before attempting to scan files
This fixes an issue where opening a FileTreeComponent could cause the UI to hang. The call to subcontentsList->isStillLoading() in FileListTreeItem::selectFile() would always return true because the file-scanner TimeSliceThread wasn't started until the selectFile() call finished.
This commit is contained in:
parent
a1bb7aeead
commit
21c214aec8
2 changed files with 4 additions and 3 deletions
|
|
@ -27,7 +27,7 @@ namespace juce
|
|||
{
|
||||
|
||||
DirectoryContentsList::DirectoryContentsList (const FileFilter* f, TimeSliceThread& t)
|
||||
: fileFilter (f), thread (t)
|
||||
: fileFilter (f), thread (t)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,9 @@ FileBrowserComponent::FileBrowserComponent (int flags_,
|
|||
filename = initialFileOrDirectory.getFileName();
|
||||
}
|
||||
|
||||
// The thread must be started before the DirectoryContentsList attempts to scan any file
|
||||
thread.startThread (4);
|
||||
|
||||
fileList.reset (new DirectoryContentsList (this, thread));
|
||||
fileList->setDirectory (currentRoot, true, true);
|
||||
|
||||
|
|
@ -122,8 +125,6 @@ FileBrowserComponent::FileBrowserComponent (int flags_,
|
|||
if (filename.isNotEmpty())
|
||||
setFileName (filename);
|
||||
|
||||
thread.startThread (4);
|
||||
|
||||
startTimer (2000);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue