diff --git a/src/plugin/vst3-plugin.cpp b/src/plugin/vst3-plugin.cpp index 7a38d18a..92258c0d 100644 --- a/src/plugin/vst3-plugin.cpp +++ b/src/plugin/vst3-plugin.cpp @@ -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 bridge; bool InitModule() { - assert(bridge == nullptr); + assert(!bridge); try { - bridge = new Vst3PluginBridge(); + bridge = std::make_unique(); 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; }