| @@ -319,7 +319,6 @@ private: | |||||
| //============================================================================== | //============================================================================== | ||||
| Atomic<int> refCount; | Atomic<int> refCount; | ||||
| std::unique_ptr<AudioProcessor> audioProcessor; | std::unique_ptr<AudioProcessor> audioProcessor; | ||||
| ScopedJuceInitialiser_GUI libraryInitialiser; | |||||
| //============================================================================== | //============================================================================== | ||||
| LegacyAudioParametersWrapper juceParameters; | LegacyAudioParametersWrapper juceParameters; | ||||
| @@ -919,7 +918,6 @@ private: | |||||
| //============================================================================== | //============================================================================== | ||||
| ComSmartPtr<JuceAudioProcessor> audioProcessor; | ComSmartPtr<JuceAudioProcessor> audioProcessor; | ||||
| ScopedJuceInitialiser_GUI libraryInitialiser; | |||||
| struct MidiController | struct MidiController | ||||
| { | { | ||||
| @@ -1513,8 +1511,6 @@ private: | |||||
| WindowsHooks hooks; | WindowsHooks hooks; | ||||
| #endif | #endif | ||||
| ScopedJuceInitialiser_GUI libraryInitialiser; | |||||
| //============================================================================== | //============================================================================== | ||||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (JuceVST3Editor) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (JuceVST3Editor) | ||||
| }; | }; | ||||
| @@ -2925,9 +2921,11 @@ struct JucePluginFactory : public IPluginFactory3 | |||||
| return false; | return false; | ||||
| } | } | ||||
| auto* entry = classes.add (new ClassEntry (info, createFunction)); | |||||
| auto entry = std::make_unique<ClassEntry> (info, createFunction); | |||||
| entry->infoW.fromAscii (info); | entry->infoW.fromAscii (info); | ||||
| classes.push_back (std::move (entry)); | |||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -2975,7 +2973,7 @@ struct JucePluginFactory : public IPluginFactory3 | |||||
| { | { | ||||
| if (info != nullptr) | if (info != nullptr) | ||||
| { | { | ||||
| if (auto* entry = classes[(int) index]) | |||||
| if (auto& entry = classes[(size_t) index]) | |||||
| { | { | ||||
| memcpy (info, &entry->infoW, sizeof (PClassInfoW)); | memcpy (info, &entry->infoW, sizeof (PClassInfoW)); | ||||
| return kResultOk; | return kResultOk; | ||||
| @@ -2987,6 +2985,8 @@ struct JucePluginFactory : public IPluginFactory3 | |||||
| tresult PLUGIN_API createInstance (FIDString cid, FIDString sourceIid, void** obj) override | tresult PLUGIN_API createInstance (FIDString cid, FIDString sourceIid, void** obj) override | ||||
| { | { | ||||
| ScopedJuceInitialiser_GUI libraryInitialiser; | |||||
| *obj = nullptr; | *obj = nullptr; | ||||
| TUID tuid; | TUID tuid; | ||||
| @@ -3008,7 +3008,7 @@ struct JucePluginFactory : public IPluginFactory3 | |||||
| TUID iidToQuery; | TUID iidToQuery; | ||||
| sourceFuid.toTUID (iidToQuery); | sourceFuid.toTUID (iidToQuery); | ||||
| for (auto* entry : classes) | |||||
| for (auto& entry : classes) | |||||
| { | { | ||||
| if (doUIDsMatch (entry->infoW.cid, cid)) | if (doUIDsMatch (entry->infoW.cid, cid)) | ||||
| { | { | ||||
| @@ -3044,7 +3044,6 @@ struct JucePluginFactory : public IPluginFactory3 | |||||
| private: | private: | ||||
| //============================================================================== | //============================================================================== | ||||
| ScopedJuceInitialiser_GUI libraryInitialiser; | |||||
| Atomic<int> refCount { 1 }; | Atomic<int> refCount { 1 }; | ||||
| const PFactoryInfo factoryInfo; | const PFactoryInfo factoryInfo; | ||||
| ComSmartPtr<Vst::IHostApplication> host; | ComSmartPtr<Vst::IHostApplication> host; | ||||
| @@ -3063,10 +3062,10 @@ private: | |||||
| bool isUnicode = false; | bool isUnicode = false; | ||||
| private: | private: | ||||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ClassEntry) | |||||
| JUCE_DECLARE_NON_COPYABLE (ClassEntry) | |||||
| }; | }; | ||||
| OwnedArray<ClassEntry> classes; | |||||
| std::vector<std::unique_ptr<ClassEntry>> classes; | |||||
| //============================================================================== | //============================================================================== | ||||
| template<class PClassInfoType> | template<class PClassInfoType> | ||||
| @@ -3076,7 +3075,7 @@ private: | |||||
| { | { | ||||
| zerostruct (*info); | zerostruct (*info); | ||||
| if (auto* entry = classes[(int) index]) | |||||
| if (auto& entry = classes[(size_t) index]) | |||||
| { | { | ||||
| if (entry->isUnicode) | if (entry->isUnicode) | ||||
| return kResultFalse; | return kResultFalse; | ||||
| @@ -3091,7 +3090,9 @@ private: | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (JucePluginFactory) | |||||
| // no leak detector here to prevent it firing on shutdown when running in hosts that | |||||
| // don't release the factory object correctly... | |||||
| JUCE_DECLARE_NON_COPYABLE (JucePluginFactory) | |||||
| }; | }; | ||||
| } // juce namespace | } // juce namespace | ||||