mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-23 17:30:17 +01:00
Module manager (#549)
* Eliminate ModuleManagerInterface... ... It was there only to provide RegisterModule(), but that was not used anywhere. So simplify. * Remove nested #include of ModuleInterface.h
This commit is contained in:
@@ -20,6 +20,7 @@ i.e. an alternative to the usual interface, for Audacity.
|
||||
|
||||
#include "Audacity.h"
|
||||
#include "ModuleManager.h"
|
||||
#include "audacity/ModuleInterface.h"
|
||||
|
||||
#include "Experimental.h"
|
||||
|
||||
@@ -446,7 +447,7 @@ void ModuleManager::InitializeBuiltins()
|
||||
for (auto moduleMain : builtinModuleList())
|
||||
{
|
||||
ModuleInterfaceHandle module {
|
||||
moduleMain(this, NULL), ModuleInterfaceDeleter{}
|
||||
moduleMain(nullptr), ModuleInterfaceDeleter{}
|
||||
};
|
||||
|
||||
if (module->Initialize())
|
||||
@@ -480,7 +481,7 @@ ModuleInterface *ModuleManager::LoadModule(const PluginPath & path)
|
||||
if (success && audacityMain)
|
||||
{
|
||||
ModuleInterfaceHandle handle {
|
||||
audacityMain(this, &path), ModuleInterfaceDeleter{}
|
||||
audacityMain(&path), ModuleInterfaceDeleter{}
|
||||
};
|
||||
if (handle)
|
||||
{
|
||||
@@ -518,27 +519,6 @@ void ModuleInterfaceDeleter::operator() (ModuleInterface *pInterface) const
|
||||
}
|
||||
}
|
||||
|
||||
void ModuleManager::RegisterModule(ModuleInterface *inModule)
|
||||
{
|
||||
std::unique_ptr<ModuleInterface> module{ inModule };
|
||||
|
||||
PluginID id = PluginManager::GetID(module.get());
|
||||
|
||||
if (mDynModules.find(id) != mDynModules.end())
|
||||
{
|
||||
// TODO: Should we complain about a duplicate registration????
|
||||
// PRL: Don't leak resources!
|
||||
module->Terminate();
|
||||
return;
|
||||
}
|
||||
|
||||
mDynModules[id] = ModuleInterfaceHandle {
|
||||
module.release(), ModuleInterfaceDeleter{}
|
||||
};
|
||||
|
||||
PluginManager::Get().RegisterPlugin(inModule);
|
||||
}
|
||||
|
||||
PluginPaths ModuleManager::FindPluginsForProvider(const PluginID & providerID,
|
||||
const PluginPath & path)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user