1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-04-02 12:35:11 +02:00

Simplify memory management in PluginManager

This commit is contained in:
Paul Licameli
2021-06-18 13:08:36 -04:00
parent 4770b1f0a4
commit 8fda526577
24 changed files with 96 additions and 192 deletions

View File

@@ -530,26 +530,14 @@ ModuleInterface *ModuleManager::CreateProviderInstance(const PluginID & provider
return nullptr;
}
ComponentInterface *ModuleManager::CreateInstance(const PluginID & providerID,
const PluginPath & path)
std::unique_ptr<ComponentInterface> ModuleManager::CreateInstance(
const PluginID & providerID, const PluginPath & path)
{
if (mDynModules.find(providerID) == mDynModules.end())
{
return NULL;
}
return mDynModules[providerID]->CreateInstance(path);
}
void ModuleManager::DeleteInstance(const PluginID & providerID,
ComponentInterface *instance)
{
if (mDynModules.find(providerID) == mDynModules.end())
{
return;
}
mDynModules[providerID]->DeleteInstance(instance);
if (auto iter = mDynModules.find(providerID);
iter == mDynModules.end())
return nullptr;
else
return iter->second->CreateInstance(path);
}
bool ModuleManager::IsProviderValid(const PluginID & WXUNUSED(providerID),