mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Use unique_ptr for managing the Vst3PluginBridge
Not quite sure why we were doing raw pointers before.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user