diff --git a/libs/ardour/ardour/vst3_plugin.h b/libs/ardour/ardour/vst3_plugin.h index f2bc6d0f98..f9e8c3329d 100644 --- a/libs/ardour/ardour/vst3_plugin.h +++ b/libs/ardour/ardour/vst3_plugin.h @@ -312,8 +312,6 @@ private: boost::optional _plugin_latency; - mutable boost::optional _has_editor; - int _n_bus_in; int _n_bus_out; @@ -461,6 +459,8 @@ public: bool is_instrument () const; PBD::Searchpath preset_search_path () const; + mutable boost::optional has_editor; + std::shared_ptr m; }; diff --git a/libs/ardour/vst3_plugin.cc b/libs/ardour/vst3_plugin.cc index e331fb00cc..a819d83d85 100644 --- a/libs/ardour/vst3_plugin.cc +++ b/libs/ardour/vst3_plugin.cc @@ -341,8 +341,14 @@ VST3Plugin::possible_output () const bool VST3Plugin::has_editor () const { - /* consider caching has-editor in VST3Info */ - return _plug->has_editor (); + std::shared_ptr nfo = std::dynamic_pointer_cast (get_info ()); + if (nfo->has_editor.has_value ()) { + return nfo->has_editor.value (); + } + + bool rv = _plug->has_editor (); + nfo->has_editor = rv; + return rv; } Steinberg::IPlugView* @@ -3180,10 +3186,6 @@ VST3PI::close_view () bool VST3PI::has_editor () const { - if (_has_editor.has_value ()) { - return _has_editor.value (); - } - IPlugView* view = _view; if (!view) { view = try_create_view (); @@ -3202,7 +3204,6 @@ VST3PI::has_editor () const view->release (); } } - _has_editor = rv; return rv; }