From 8ba6e4a9377f7de5b833d8efeff8cff193e38ebe Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Fri, 14 May 2021 17:30:05 +0200 Subject: [PATCH] Noexcept qualify the VST3 proxy implementations For the same reasons mentioned in the last commit. --- src/plugin/bridges/vst3-impls/context-menu-target.cpp | 2 +- src/plugin/bridges/vst3-impls/context-menu-target.h | 2 +- src/plugin/bridges/vst3-impls/plug-view-proxy.cpp | 7 +++++-- src/plugin/bridges/vst3-impls/plug-view-proxy.h | 4 ++-- src/plugin/bridges/vst3-impls/plugin-factory-proxy.cpp | 2 +- src/plugin/bridges/vst3-impls/plugin-factory-proxy.h | 2 +- src/plugin/bridges/vst3-impls/plugin-proxy.cpp | 9 ++++++--- src/plugin/bridges/vst3-impls/plugin-proxy.h | 6 +++--- .../bridges/vst3-impls/component-handler-proxy.cpp | 2 +- .../bridges/vst3-impls/component-handler-proxy.h | 2 +- .../bridges/vst3-impls/connection-point-proxy.cpp | 2 +- .../bridges/vst3-impls/connection-point-proxy.h | 2 +- src/wine-host/bridges/vst3-impls/context-menu-proxy.cpp | 7 +++++-- src/wine-host/bridges/vst3-impls/context-menu-proxy.h | 7 ++++--- src/wine-host/bridges/vst3-impls/host-context-proxy.cpp | 2 +- src/wine-host/bridges/vst3-impls/host-context-proxy.h | 2 +- src/wine-host/bridges/vst3-impls/plug-frame-proxy.cpp | 2 +- src/wine-host/bridges/vst3-impls/plug-frame-proxy.h | 2 +- 18 files changed, 37 insertions(+), 27 deletions(-) diff --git a/src/plugin/bridges/vst3-impls/context-menu-target.cpp b/src/plugin/bridges/vst3-impls/context-menu-target.cpp index fe443bdf..7ce71ba3 100644 --- a/src/plugin/bridges/vst3-impls/context-menu-target.cpp +++ b/src/plugin/bridges/vst3-impls/context-menu-target.cpp @@ -17,7 +17,7 @@ #include "context-menu-target.h" YaContextMenuTargetImpl::YaContextMenuTargetImpl(Vst3PluginBridge& bridge, - const ConstructArgs&& args) + const ConstructArgs&& args) noexcept : YaContextMenuTarget(std::move(args)), bridge(bridge) {} tresult PLUGIN_API diff --git a/src/plugin/bridges/vst3-impls/context-menu-target.h b/src/plugin/bridges/vst3-impls/context-menu-target.h index 595a73e3..996921d0 100644 --- a/src/plugin/bridges/vst3-impls/context-menu-target.h +++ b/src/plugin/bridges/vst3-impls/context-menu-target.h @@ -21,7 +21,7 @@ class YaContextMenuTargetImpl : public YaContextMenuTarget { public: YaContextMenuTargetImpl(Vst3PluginBridge& bridge, - const ConstructArgs&& args); + const ConstructArgs&& args) noexcept; /** * We'll override the query interface to log queries for interfaces we do diff --git a/src/plugin/bridges/vst3-impls/plug-view-proxy.cpp b/src/plugin/bridges/vst3-impls/plug-view-proxy.cpp index 2162f196..7f39f80c 100644 --- a/src/plugin/bridges/vst3-impls/plug-view-proxy.cpp +++ b/src/plugin/bridges/vst3-impls/plug-view-proxy.cpp @@ -86,16 +86,19 @@ RunLoopTasks::onFDIsSet(Steinberg::Linux::FileDescriptor /*fd*/) { Vst3PlugViewProxyImpl::Vst3PlugViewProxyImpl( Vst3PluginBridge& bridge, std::atomic_bool& is_active, - Vst3PlugViewProxy::ConstructArgs&& args) + Vst3PlugViewProxy::ConstructArgs&& args) noexcept : Vst3PlugViewProxy(std::move(args)), bridge(bridge), is_active(is_active) { is_active = true; } -Vst3PlugViewProxyImpl::~Vst3PlugViewProxyImpl() { +Vst3PlugViewProxyImpl::~Vst3PlugViewProxyImpl() noexcept { is_active = false; // Also drop the plug view smart pointer on the Wine side when this gets // dropped + // NOTE: This can actually throw (e.g. out of memory or the socket got + // closed). But if that were to happen, then we wouldn't be able to + // recover from it anyways. send_mutually_recursive_message( Vst3PlugViewProxy::Destruct{.owner_instance_id = owner_instance_id()}); } diff --git a/src/plugin/bridges/vst3-impls/plug-view-proxy.h b/src/plugin/bridges/vst3-impls/plug-view-proxy.h index 77d33baf..146d2d50 100644 --- a/src/plugin/bridges/vst3-impls/plug-view-proxy.h +++ b/src/plugin/bridges/vst3-impls/plug-view-proxy.h @@ -107,14 +107,14 @@ class Vst3PlugViewProxyImpl : public Vst3PlugViewProxy { public: Vst3PlugViewProxyImpl(Vst3PluginBridge& bridge, std::atomic_bool& is_active, - Vst3PlugViewProxy::ConstructArgs&& args); + Vst3PlugViewProxy::ConstructArgs&& args) noexcept; /** * When the reference count reaches zero and this destructor is called, * we'll send a request to the Wine plugin host to destroy the corresponding * object. */ - ~Vst3PlugViewProxyImpl(); + ~Vst3PlugViewProxyImpl() noexcept override; /** * We'll override the query interface to log queries for interfaces we do diff --git a/src/plugin/bridges/vst3-impls/plugin-factory-proxy.cpp b/src/plugin/bridges/vst3-impls/plugin-factory-proxy.cpp index b2b7ba91..2b5fa328 100644 --- a/src/plugin/bridges/vst3-impls/plugin-factory-proxy.cpp +++ b/src/plugin/bridges/vst3-impls/plugin-factory-proxy.cpp @@ -23,7 +23,7 @@ Vst3PluginFactoryProxyImpl::Vst3PluginFactoryProxyImpl( Vst3PluginBridge& bridge, - Vst3PluginFactoryProxy::ConstructArgs&& args) + Vst3PluginFactoryProxy::ConstructArgs&& args) noexcept : Vst3PluginFactoryProxy(std::move(args)), bridge(bridge) {} tresult PLUGIN_API diff --git a/src/plugin/bridges/vst3-impls/plugin-factory-proxy.h b/src/plugin/bridges/vst3-impls/plugin-factory-proxy.h index 9615989f..be48db35 100644 --- a/src/plugin/bridges/vst3-impls/plugin-factory-proxy.h +++ b/src/plugin/bridges/vst3-impls/plugin-factory-proxy.h @@ -25,7 +25,7 @@ class Vst3PluginBridge; class Vst3PluginFactoryProxyImpl : public Vst3PluginFactoryProxy { public: Vst3PluginFactoryProxyImpl(Vst3PluginBridge& bridge, - Vst3PluginFactoryProxy::ConstructArgs&& args); + Vst3PluginFactoryProxy::ConstructArgs&& args) noexcept; /** * We'll override the query interface to log queries for interfaces we do diff --git a/src/plugin/bridges/vst3-impls/plugin-proxy.cpp b/src/plugin/bridges/vst3-impls/plugin-proxy.cpp index 2ac44ac3..24f1c08b 100644 --- a/src/plugin/bridges/vst3-impls/plugin-proxy.cpp +++ b/src/plugin/bridges/vst3-impls/plugin-proxy.cpp @@ -45,7 +45,10 @@ Vst3PluginProxyImpl::Vst3PluginProxyImpl(Vst3PluginBridge& bridge, bridge.register_plugin_proxy(*this); } -Vst3PluginProxyImpl::~Vst3PluginProxyImpl() { +Vst3PluginProxyImpl::~Vst3PluginProxyImpl() noexcept { + // NOTE: This can actually throw (e.g. out of memory or the socket got + // closed). But if that were to happen, then we wouldn't be able to + // recover from it anyways. bridge.send_message( Vst3PluginProxy::Destruct{.instance_id = instance_id()}); bridge.unregister_plugin_proxy(*this); @@ -80,7 +83,7 @@ bool Vst3PluginProxyImpl::unregister_context_menu(size_t context_menu_id) { return context_menus.erase(context_menu_id); } -void Vst3PluginProxyImpl::clear_caches() { +void Vst3PluginProxyImpl::clear_caches() noexcept { clear_bus_cache(); std::lock_guard lock(function_result_cache_mutex); @@ -1325,7 +1328,7 @@ tresult PLUGIN_API Vst3PluginProxyImpl::getXmlRepresentationStream( } } -void Vst3PluginProxyImpl::clear_bus_cache() { +void Vst3PluginProxyImpl::clear_bus_cache() noexcept { std::lock_guard lock(processing_bus_cache_mutex); if (processing_bus_cache) { processing_bus_cache.emplace(); diff --git a/src/plugin/bridges/vst3-impls/plugin-proxy.h b/src/plugin/bridges/vst3-impls/plugin-proxy.h index 3ac986f0..5fc6e94e 100644 --- a/src/plugin/bridges/vst3-impls/plugin-proxy.h +++ b/src/plugin/bridges/vst3-impls/plugin-proxy.h @@ -36,7 +36,7 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy { * we'll send a request to the Wine plugin host to destroy the corresponding * object. */ - ~Vst3PluginProxyImpl(); + ~Vst3PluginProxyImpl() noexcept override; /** * We'll override the query interface to log queries for interfaces we do @@ -72,7 +72,7 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy { * @see clear_bus_cache * @see function_result_cache */ - void clear_caches(); + void clear_caches() noexcept; // From `IAudioPresentationLatency` tresult PLUGIN_API @@ -415,7 +415,7 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy { * * @see processing_bus_cache */ - void clear_bus_cache(); + void clear_bus_cache() noexcept; /** * If we have an active `IPlugView` instance, try to use the mutual diff --git a/src/wine-host/bridges/vst3-impls/component-handler-proxy.cpp b/src/wine-host/bridges/vst3-impls/component-handler-proxy.cpp index c8300c6d..96751b5e 100644 --- a/src/wine-host/bridges/vst3-impls/component-handler-proxy.cpp +++ b/src/wine-host/bridges/vst3-impls/component-handler-proxy.cpp @@ -22,7 +22,7 @@ Vst3ComponentHandlerProxyImpl::Vst3ComponentHandlerProxyImpl( Vst3Bridge& bridge, - Vst3ComponentHandlerProxy::ConstructArgs&& args) + Vst3ComponentHandlerProxy::ConstructArgs&& args) noexcept : Vst3ComponentHandlerProxy(std::move(args)), bridge(bridge) { // The lifecycle of this object is managed together with that of the plugin // object instance this host context got passed to diff --git a/src/wine-host/bridges/vst3-impls/component-handler-proxy.h b/src/wine-host/bridges/vst3-impls/component-handler-proxy.h index 1b4410d5..859b7a80 100644 --- a/src/wine-host/bridges/vst3-impls/component-handler-proxy.h +++ b/src/wine-host/bridges/vst3-impls/component-handler-proxy.h @@ -22,7 +22,7 @@ class Vst3ComponentHandlerProxyImpl : public Vst3ComponentHandlerProxy { public: Vst3ComponentHandlerProxyImpl( Vst3Bridge& bridge, - Vst3ComponentHandlerProxy::ConstructArgs&& args); + Vst3ComponentHandlerProxy::ConstructArgs&& args) noexcept; /** * We'll override the query interface to log queries for interfaces we do diff --git a/src/wine-host/bridges/vst3-impls/connection-point-proxy.cpp b/src/wine-host/bridges/vst3-impls/connection-point-proxy.cpp index f4ef6ff0..691286b9 100644 --- a/src/wine-host/bridges/vst3-impls/connection-point-proxy.cpp +++ b/src/wine-host/bridges/vst3-impls/connection-point-proxy.cpp @@ -20,7 +20,7 @@ Vst3ConnectionPointProxyImpl::Vst3ConnectionPointProxyImpl( Vst3Bridge& bridge, - Vst3ConnectionPointProxy::ConstructArgs&& args) + Vst3ConnectionPointProxy::ConstructArgs&& args) noexcept : Vst3ConnectionPointProxy(std::move(args)), bridge(bridge) {} tresult PLUGIN_API diff --git a/src/wine-host/bridges/vst3-impls/connection-point-proxy.h b/src/wine-host/bridges/vst3-impls/connection-point-proxy.h index 7691c21f..d7c5c523 100644 --- a/src/wine-host/bridges/vst3-impls/connection-point-proxy.h +++ b/src/wine-host/bridges/vst3-impls/connection-point-proxy.h @@ -22,7 +22,7 @@ class Vst3ConnectionPointProxyImpl : public Vst3ConnectionPointProxy { public: Vst3ConnectionPointProxyImpl( Vst3Bridge& bridge, - Vst3ConnectionPointProxy::ConstructArgs&& args); + Vst3ConnectionPointProxy::ConstructArgs&& args) noexcept; /** * We'll override the query interface to log queries for interfaces we do diff --git a/src/wine-host/bridges/vst3-impls/context-menu-proxy.cpp b/src/wine-host/bridges/vst3-impls/context-menu-proxy.cpp index 8fa59869..dbc1d408 100644 --- a/src/wine-host/bridges/vst3-impls/context-menu-proxy.cpp +++ b/src/wine-host/bridges/vst3-impls/context-menu-proxy.cpp @@ -20,14 +20,17 @@ Vst3ContextMenuProxyImpl::Vst3ContextMenuProxyImpl( Vst3Bridge& bridge, - Vst3ContextMenuProxy::ConstructArgs&& args) + Vst3ContextMenuProxy::ConstructArgs&& args) noexcept : Vst3ContextMenuProxy(std::move(args)), bridge(bridge) { bridge.register_context_menu(*this); } -Vst3ContextMenuProxyImpl::~Vst3ContextMenuProxyImpl() { +Vst3ContextMenuProxyImpl::~Vst3ContextMenuProxyImpl() noexcept { // Also drop the context menu smart pointer on plugin side when this gets // dropped + // NOTE: This can actually throw (e.g. out of memory or the socket got + // closed). But if that were to happen, then we wouldn't be able to + // recover from it anyways. bridge.send_message( Vst3ContextMenuProxy::Destruct{.owner_instance_id = owner_instance_id(), .context_menu_id = context_menu_id()}); diff --git a/src/wine-host/bridges/vst3-impls/context-menu-proxy.h b/src/wine-host/bridges/vst3-impls/context-menu-proxy.h index 5e25a16c..e90359cc 100644 --- a/src/wine-host/bridges/vst3-impls/context-menu-proxy.h +++ b/src/wine-host/bridges/vst3-impls/context-menu-proxy.h @@ -20,14 +20,15 @@ class Vst3ContextMenuProxyImpl : public Vst3ContextMenuProxy { public: - Vst3ContextMenuProxyImpl(Vst3Bridge& bridge, - Vst3ContextMenuProxy::ConstructArgs&& args); + Vst3ContextMenuProxyImpl( + Vst3Bridge& bridge, + Vst3ContextMenuProxy::ConstructArgs&& args) noexcept; /** * When the reference count reaches zero and this destructor is called, * we'll send a request to plugin to destroy the corresponding object. */ - ~Vst3ContextMenuProxyImpl(); + ~Vst3ContextMenuProxyImpl() noexcept override; /** * We'll override the query interface to log queries for interfaces we do diff --git a/src/wine-host/bridges/vst3-impls/host-context-proxy.cpp b/src/wine-host/bridges/vst3-impls/host-context-proxy.cpp index 3a38e226..85761e18 100644 --- a/src/wine-host/bridges/vst3-impls/host-context-proxy.cpp +++ b/src/wine-host/bridges/vst3-impls/host-context-proxy.cpp @@ -23,7 +23,7 @@ Vst3HostContextProxyImpl::Vst3HostContextProxyImpl( Vst3Bridge& bridge, - Vst3HostContextProxy::ConstructArgs&& args) + Vst3HostContextProxy::ConstructArgs&& args) noexcept : Vst3HostContextProxy(std::move(args)), bridge(bridge) { // The lifecycle of this object is managed together with that of the plugin // object instance this host context got passed to diff --git a/src/wine-host/bridges/vst3-impls/host-context-proxy.h b/src/wine-host/bridges/vst3-impls/host-context-proxy.h index ca33011f..ff555725 100644 --- a/src/wine-host/bridges/vst3-impls/host-context-proxy.h +++ b/src/wine-host/bridges/vst3-impls/host-context-proxy.h @@ -21,7 +21,7 @@ class Vst3HostContextProxyImpl : public Vst3HostContextProxy { public: Vst3HostContextProxyImpl(Vst3Bridge& bridge, - Vst3HostContextProxy::ConstructArgs&& args); + Vst3HostContextProxy::ConstructArgs&& args) noexcept; /** * We'll override the query interface to log queries for interfaces we do diff --git a/src/wine-host/bridges/vst3-impls/plug-frame-proxy.cpp b/src/wine-host/bridges/vst3-impls/plug-frame-proxy.cpp index fa40d0aa..b4fd7b7c 100644 --- a/src/wine-host/bridges/vst3-impls/plug-frame-proxy.cpp +++ b/src/wine-host/bridges/vst3-impls/plug-frame-proxy.cpp @@ -20,7 +20,7 @@ Vst3PlugFrameProxyImpl::Vst3PlugFrameProxyImpl( Vst3Bridge& bridge, - Vst3PlugFrameProxy::ConstructArgs&& args) + Vst3PlugFrameProxy::ConstructArgs&& args) noexcept : Vst3PlugFrameProxy(std::move(args)), bridge(bridge) { // The lifecycle of this object is managed together with that of the plugin // object instance this host context got passed to diff --git a/src/wine-host/bridges/vst3-impls/plug-frame-proxy.h b/src/wine-host/bridges/vst3-impls/plug-frame-proxy.h index f8a1ac8b..ac28f384 100644 --- a/src/wine-host/bridges/vst3-impls/plug-frame-proxy.h +++ b/src/wine-host/bridges/vst3-impls/plug-frame-proxy.h @@ -21,7 +21,7 @@ class Vst3PlugFrameProxyImpl : public Vst3PlugFrameProxy { public: Vst3PlugFrameProxyImpl(Vst3Bridge& bridge, - Vst3PlugFrameProxy::ConstructArgs&& args); + Vst3PlugFrameProxy::ConstructArgs&& args) noexcept; /** * We'll override the query interface to log queries for interfaces we do