Browse Source

Fix for a subtle race condition in plugin scanning.

tags/2021-05-28
jules 12 years ago
parent
commit
575725e39d
4 changed files with 12 additions and 10 deletions
  1. +0
    -2
      modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm
  2. +5
    -2
      modules/juce_audio_processors/scanning/juce_PluginDirectoryScanner.cpp
  3. +4
    -1
      modules/juce_audio_processors/scanning/juce_PluginDirectoryScanner.h
  4. +3
    -5
      modules/juce_audio_processors/scanning/juce_PluginListComponent.cpp

+ 0
- 2
modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm View File

@@ -115,8 +115,6 @@ namespace AudioUnitFormatHelpers
{
name = String::fromCFString (cfName);
CFRelease (cfName);
DBG ("AU name: " + name);
}
if (name.containsChar (':'))


+ 5
- 2
modules/juce_audio_processors/scanning/juce_PluginDirectoryScanner.cpp View File

@@ -76,16 +76,19 @@ void PluginDirectoryScanner::updateProgress()
progress = (1.0f - nextIndex.get() / (float) filesOrIdentifiersToScan.size());
}
bool PluginDirectoryScanner::scanNextFile (const bool dontRescanIfAlreadyInList)
bool PluginDirectoryScanner::scanNextFile (const bool dontRescanIfAlreadyInList,
String& nameOfPluginBeingScanned)
{
const int index = --nextIndex;
if (index >= 0)
{
String file (filesOrIdentifiersToScan [index]);
const String file (filesOrIdentifiersToScan [index]);
if (file.isNotEmpty() && ! list.isListingUpToDate (file, format))
{
nameOfPluginBeingScanned = format.getNameOfPluginFromIdentifier (file);
OwnedArray <PluginDescription> typesFound;
// Add this plugin to the end of the dead-man's pedal list in case it crashes...


+ 4
- 1
modules/juce_audio_processors/scanning/juce_PluginDirectoryScanner.h View File

@@ -77,10 +77,13 @@ public:
re-tested if it's not already in the list, or if the file's modification
time has changed since the list was created. If dontRescanIfAlreadyInList is
false, the file will always be reloaded and tested.
The nameOfPluginBeingScanned will be updated to the name of the plugin being
scanned before the scan starts.
Returns false when there are no more files to try.
*/
bool scanNextFile (bool dontRescanIfAlreadyInList);
bool scanNextFile (bool dontRescanIfAlreadyInList,
String& nameOfPluginBeingScanned);
/** Skips over the next file without scanning it.
Returns false when there are no more files to try.


+ 3
- 5
modules/juce_audio_processors/scanning/juce_PluginListComponent.cpp View File

@@ -365,14 +365,12 @@ private:
if (finished)
finishedScan();
else
progressWindow.setMessage (progressMessage);
progressWindow.setMessage (TRANS("Testing") + ":\n\n" + pluginBeingScanned);
}
bool doNextScan()
{
progressMessage = TRANS("Testing") + ":\n\n" + scanner->getNextPluginFileThatWillBeScanned();
if (scanner->scanNextFile (true))
if (scanner->scanNextFile (true, pluginBeingScanned))
{
progress = scanner->getProgress();
return true;
@@ -388,7 +386,7 @@ private:
ScopedPointer<PluginDirectoryScanner> scanner;
AlertWindow pathChooserWindow, progressWindow;
FileSearchPathListComponent pathList;
String progressMessage;
String pluginBeingScanned;
double progress;
int numThreads;
bool finished;


Loading…
Cancel
Save