1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 09:20:16 +01:00

Complementary un-registration of providers; change function name

This commit is contained in:
Paul Licameli
2020-10-02 14:30:53 -04:00
parent 64bbc31c54
commit 861470dd77
3 changed files with 28 additions and 4 deletions

View File

@@ -182,13 +182,23 @@ namespace {
}
}
void RegisterBuiltinModule(ModuleMain moduleMain)
void RegisterProvider(ModuleMain moduleMain)
{
builtinModuleList().push_back(moduleMain);
auto &list = builtinModuleList();
if ( moduleMain )
list.push_back(moduleMain);
return;
}
void UnregisterProvider(ModuleMain moduleMain)
{
auto &list = builtinModuleList();
auto end = list.end(), iter = std::find(list.begin(), end, moduleMain);
if (iter != end)
list.erase(iter);
}
// ----------------------------------------------------------------------------
// Creation/Destruction
// ----------------------------------------------------------------------------

View File

@@ -136,6 +136,13 @@ private:
using ModuleMain = ModuleInterface *(*)(const wxString *path);
AUDACITY_DLL_API
void RegisterBuiltinModule(ModuleMain rtn);
void RegisterProvider(ModuleMain rtn);
AUDACITY_DLL_API
void UnregisterProvider(ModuleMain rtn);
// Guarantee the registry exists before any registrations, so it will
// be destroyed only after the un-registrations
static struct Init{
Init() { RegisterProvider(nullptr); } } sInitBuiltinModules;
#endif /* __AUDACITY_MODULEMANAGER_H__ */