mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
VST3: Removed some unnecessary ScopedJuceInitialiser_GUI objects and silenced some leak detector warnings when running in hosts that don't release the IPluginFactory correctly
This commit is contained in:
parent
c194389cb5
commit
6b5fc49f71
1 changed files with 13 additions and 12 deletions
|
|
@ -319,7 +319,6 @@ private:
|
|||
//==============================================================================
|
||||
Atomic<int> refCount;
|
||||
std::unique_ptr<AudioProcessor> audioProcessor;
|
||||
ScopedJuceInitialiser_GUI libraryInitialiser;
|
||||
|
||||
//==============================================================================
|
||||
LegacyAudioParametersWrapper juceParameters;
|
||||
|
|
@ -919,7 +918,6 @@ private:
|
|||
|
||||
//==============================================================================
|
||||
ComSmartPtr<JuceAudioProcessor> audioProcessor;
|
||||
ScopedJuceInitialiser_GUI libraryInitialiser;
|
||||
|
||||
struct MidiController
|
||||
{
|
||||
|
|
@ -1513,8 +1511,6 @@ private:
|
|||
WindowsHooks hooks;
|
||||
#endif
|
||||
|
||||
ScopedJuceInitialiser_GUI libraryInitialiser;
|
||||
|
||||
//==============================================================================
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (JuceVST3Editor)
|
||||
};
|
||||
|
|
@ -2925,9 +2921,11 @@ struct JucePluginFactory : public IPluginFactory3
|
|||
return false;
|
||||
}
|
||||
|
||||
auto* entry = classes.add (new ClassEntry (info, createFunction));
|
||||
auto entry = std::make_unique<ClassEntry> (info, createFunction);
|
||||
entry->infoW.fromAscii (info);
|
||||
|
||||
classes.push_back (std::move (entry));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -2975,7 +2973,7 @@ struct JucePluginFactory : public IPluginFactory3
|
|||
{
|
||||
if (info != nullptr)
|
||||
{
|
||||
if (auto* entry = classes[(int) index])
|
||||
if (auto& entry = classes[(size_t) index])
|
||||
{
|
||||
memcpy (info, &entry->infoW, sizeof (PClassInfoW));
|
||||
return kResultOk;
|
||||
|
|
@ -2987,6 +2985,8 @@ struct JucePluginFactory : public IPluginFactory3
|
|||
|
||||
tresult PLUGIN_API createInstance (FIDString cid, FIDString sourceIid, void** obj) override
|
||||
{
|
||||
ScopedJuceInitialiser_GUI libraryInitialiser;
|
||||
|
||||
*obj = nullptr;
|
||||
|
||||
TUID tuid;
|
||||
|
|
@ -3008,7 +3008,7 @@ struct JucePluginFactory : public IPluginFactory3
|
|||
TUID iidToQuery;
|
||||
sourceFuid.toTUID (iidToQuery);
|
||||
|
||||
for (auto* entry : classes)
|
||||
for (auto& entry : classes)
|
||||
{
|
||||
if (doUIDsMatch (entry->infoW.cid, cid))
|
||||
{
|
||||
|
|
@ -3044,7 +3044,6 @@ struct JucePluginFactory : public IPluginFactory3
|
|||
|
||||
private:
|
||||
//==============================================================================
|
||||
ScopedJuceInitialiser_GUI libraryInitialiser;
|
||||
Atomic<int> refCount { 1 };
|
||||
const PFactoryInfo factoryInfo;
|
||||
ComSmartPtr<Vst::IHostApplication> host;
|
||||
|
|
@ -3063,10 +3062,10 @@ private:
|
|||
bool isUnicode = false;
|
||||
|
||||
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>
|
||||
|
|
@ -3076,7 +3075,7 @@ private:
|
|||
{
|
||||
zerostruct (*info);
|
||||
|
||||
if (auto* entry = classes[(int) index])
|
||||
if (auto& entry = classes[(size_t) index])
|
||||
{
|
||||
if (entry->isUnicode)
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue