1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-09 22:53:55 +01:00

Plugin instances managed without naked new and delete

This commit is contained in:
Paul Licameli
2016-03-31 09:42:16 -04:00
parent 3481e678ea
commit a9afad17ca
9 changed files with 60 additions and 46 deletions

View File

@@ -327,16 +327,17 @@ bool BuiltinEffectsModule::IsPluginValid(const wxString & path)
IdentInterface *BuiltinEffectsModule::CreateInstance(const wxString & path)
{
// Acquires a resource for the application.
// Safety of this depends on complementary calls to DeleteInstance on the module manager side.
return Instantiate(path);
}
void BuiltinEffectsModule::DeleteInstance(IdentInterface *instance)
{
Effect *effect = dynamic_cast<Effect *>(instance);
if (effect)
{
delete effect;
}
// Releases the resource.
std::unique_ptr < Effect > {
dynamic_cast<Effect *>(instance)
};
}
// ============================================================================