VST3: ignore GUI size allocations before realizing the view
This fixes crashes with some VST3s when calling `onSize()` before attaching thew view (e.g. Reason Rack Plug on macOS).
This commit is contained in:
parent
aef366c156
commit
7e2bb01ff1
@ -65,6 +65,7 @@ VST3HWNDPluginUI::view_realized ()
|
||||
if (kResultOk != view->attached (reinterpret_cast<void*> (hwnd), Steinberg::kPlatformTypeHWND)) {
|
||||
assert (0);
|
||||
}
|
||||
_view_realized = true;
|
||||
|
||||
ViewRect rect;
|
||||
if (view->getSize (&rect) == kResultOk) {
|
||||
@ -86,7 +87,7 @@ void
|
||||
VST3HWNDPluginUI::view_size_allocate (Gtk::Allocation& allocation)
|
||||
{
|
||||
IPlugView* view = _vst3->view ();
|
||||
if (!view) {
|
||||
if (!view || !_view_realized) {
|
||||
return;
|
||||
}
|
||||
PBD::Unwinder<bool> uw (_resize_in_progress, true);
|
||||
|
@ -106,7 +106,7 @@ void
|
||||
VST3NSViewPluginUI::view_size_allocate (Gtk::Allocation& allocation)
|
||||
{
|
||||
IPlugView* view = _vst3->view ();
|
||||
if (!view) {
|
||||
if (!view || !_view_realized) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -133,7 +133,8 @@ VST3NSViewPluginUI::view_size_allocate (Gtk::Allocation& allocation)
|
||||
allocation.set_height (rect.bottom - rect.top);
|
||||
#endif
|
||||
if (view->canResize() == kResultTrue) {
|
||||
view->onSize (&rect);
|
||||
printf ("canResize\n");
|
||||
//view->onSize (&rect); // crash here
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,6 +183,7 @@ VST3NSViewPluginUI::view_realized ()
|
||||
|
||||
NSView* nsview = gdk_quartz_window_get_nsview (_gui_widget.get_window()->gobj());
|
||||
[nsview addSubview:_ns_view];
|
||||
_view_realized = true;
|
||||
_gui_widget.queue_resize ();
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@ VST3PluginUI::VST3PluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_pt
|
||||
, _req_width (0)
|
||||
, _req_height (0)
|
||||
, _resize_in_progress (false)
|
||||
, _view_realized (false)
|
||||
{
|
||||
_ardour_buttons_box.set_spacing (6);
|
||||
_ardour_buttons_box.set_border_width (6);
|
||||
@ -55,6 +56,7 @@ VST3PluginUI::VST3PluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_pt
|
||||
|
||||
VST3PluginUI::~VST3PluginUI ()
|
||||
{
|
||||
assert (_view_realized);
|
||||
_vst3->close_view ();
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,7 @@ protected:
|
||||
int _req_height;
|
||||
|
||||
bool _resize_in_progress;
|
||||
bool _view_realized;
|
||||
|
||||
private:
|
||||
void parameter_update ();
|
||||
|
@ -203,6 +203,7 @@ VST3X11PluginUI::view_realized ()
|
||||
if (kResultOk != view->attached (reinterpret_cast<void*> (window), Steinberg::kPlatformTypeX11EmbedWindowID)) {
|
||||
assert (0);
|
||||
}
|
||||
_view_realized = true;
|
||||
#if 0
|
||||
_gui_widget.set_sensitive (true);
|
||||
_gui_widget.set_can_focus (true);
|
||||
@ -228,7 +229,7 @@ void
|
||||
VST3X11PluginUI::view_size_allocate (Gtk::Allocation& allocation)
|
||||
{
|
||||
IPlugView* view = _vst3->view ();
|
||||
if (!view) {
|
||||
if (!view || !_view_realized) {
|
||||
return;
|
||||
}
|
||||
PBD::Unwinder<bool> uw (_resize_in_progress, true);
|
||||
|
Loading…
Reference in New Issue
Block a user