mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 12:10:09 +02:00
Fix event handlers not being unregistered
This would cause crashes in Bitwig, as `RunLoopTasks`' destructor would not be run after the event handler has been unregistered, and we unregister the event handler in that destructor.
This commit is contained in:
@@ -211,12 +211,12 @@ Vst3PlugViewProxyImpl::setFrame(Steinberg::IPlugFrame* frame) {
|
||||
// owned by REAPER then REAPER will eventually segfault We should thus
|
||||
// try to call those functions from an `IRunLoop` event handler.
|
||||
try {
|
||||
run_loop_tasks = Steinberg::owned(new RunLoopTasks(plug_frame));
|
||||
run_loop_tasks.emplace(plug_frame);
|
||||
} catch (const std::runtime_error& e) {
|
||||
// In case the host does not support `IRunLoop` or if we can't
|
||||
// register an event handler, we'll throw during `RunLoopTasks`'
|
||||
// constructor
|
||||
run_loop_tasks = nullptr;
|
||||
run_loop_tasks.reset();
|
||||
|
||||
bridge.logger.log(
|
||||
"The host does not support IRunLoop, falling back to naive GUI "
|
||||
|
||||
@@ -278,9 +278,7 @@ class Vst3PlugViewProxyImpl : public Vst3PlugViewProxy {
|
||||
* the host's GUI thread using a run loop event handler in
|
||||
* `Vst3PlugViewProxyImpl::run_gui_task`.
|
||||
*
|
||||
* _This value is optional_ and it will this be a null pointer of the host
|
||||
* does not support `IRunLoop`. We have to use an `IPtr` instead of a an
|
||||
* `std::optional` in case the host also stores a pointer to this.
|
||||
* This will be an `std::nullopt` if the hostdoes not support `IRunLoop`.
|
||||
*/
|
||||
Steinberg::IPtr<RunLoopTasks> run_loop_tasks;
|
||||
std::optional<RunLoopTasks> run_loop_tasks;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user