mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-10 04:30:12 +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
|
// 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.
|
// of the bundle, even if it does not come in a bundle itself.
|
||||||
|
|
||||||
Vst3PluginBridge* bridge = nullptr;
|
std::unique_ptr<Vst3PluginBridge> bridge;
|
||||||
|
|
||||||
bool InitModule() {
|
bool InitModule() {
|
||||||
assert(bridge == nullptr);
|
assert(!bridge);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
bridge = new Vst3PluginBridge();
|
bridge = std::make_unique<Vst3PluginBridge>();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (const std::exception& error) {
|
} catch (const std::exception& error) {
|
||||||
@@ -51,10 +51,9 @@ bool InitModule() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DeinitModule() {
|
bool DeinitModule() {
|
||||||
assert(bridge != nullptr);
|
assert(bridge);
|
||||||
|
|
||||||
delete bridge;
|
bridge.reset();
|
||||||
bridge = nullptr;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user