Use unique_ptr for managing the Vst3PluginBridge

Not quite sure why we were doing raw pointers before.
This commit is contained in:
Robbert van der Helm
2021-01-11 17:09:43 +01:00
parent 3ca7061659
commit 10b8ef7870
+5 -6
View File
@@ -32,13 +32,13 @@
// plugin symlinked to either the `x86_64-win` or the `x86-win` directory inside
// of the bundle, even if it does not come in a bundle itself.
Vst3PluginBridge* bridge = nullptr;
std::unique_ptr<Vst3PluginBridge> bridge;
bool InitModule() {
assert(bridge == nullptr);
assert(!bridge);
try {
bridge = new Vst3PluginBridge();
bridge = std::make_unique<Vst3PluginBridge>();
return true;
} catch (const std::exception& error) {
@@ -51,10 +51,9 @@ bool InitModule() {
}
bool DeinitModule() {
assert(bridge != nullptr);
assert(bridge);
delete bridge;
bridge = nullptr;
bridge.reset();
return true;
}