Keep track of the last created plugin view

For implementing `IPlugView::resizeView()`. This approach is safe
because there's only a single defined view type.
This commit is contained in:
Robbert van der Helm
2020-12-22 14:27:56 +01:00
parent da6ddccf07
commit 3bc3409929
2 changed files with 21 additions and 2 deletions
@@ -363,8 +363,15 @@ Vst3PluginProxyImpl::createView(Steinberg::FIDString name) {
if (response.plug_view_args) {
// The host should manage this. Returning raw pointers feels scary.
return new Vst3PlugViewProxyImpl(bridge,
std::move(*response.plug_view_args));
auto plug_view_proxy = new Vst3PlugViewProxyImpl(
bridge, std::move(*response.plug_view_args));
// We also need to store an (unmanaged, since we don't want to affect
// the reference counting) pointer to this to be able to handle calls to
// `IPlugFrame::resizeView()` in the future
last_created_plug_view = plug_view_proxy;
return plug_view_proxy;
} else {
return nullptr;
}