From 35552abc4d060f60cb60e9c1e9be61b1693f1d14 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 25 Jan 2021 02:14:26 +0100 Subject: [PATCH] VST3: allow multiple fdes per plugin UI (#8550) --- gtk2_ardour/vst3_x11_plugin_ui.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/vst3_x11_plugin_ui.cc b/gtk2_ardour/vst3_x11_plugin_ui.cc index 88fc7399cc..8b1003f1d0 100644 --- a/gtk2_ardour/vst3_x11_plugin_ui.cc +++ b/gtk2_ardour/vst3_x11_plugin_ui.cc @@ -117,16 +117,22 @@ public: return kInvalidArgument; } + std::vector::iterator> to_erase; + + tresult rv = false; + Glib::Threads::Mutex::Lock lm (_lock); - for (boost::unordered_map::iterator it = _event_handlers.begin (); it != _event_handlers.end (); ++it) { + for (boost::unordered_map::iterator it = _event_handlers.begin (); it != _event_handlers.end ();) { if (it->second._handler == handler) { g_source_remove (it->second._source_id); g_io_channel_unref (it->second._gio_channel); - _event_handlers.erase (it); - return kResultTrue; + it = _event_handlers.erase (it); + rv = kResultTrue; + } else { + ++it; } } - return kResultFalse; + return rv; } tresult registerTimer (Linux::ITimerHandler* handler, TimerInterval milliseconds) SMTG_OVERRIDE