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)) {
|
if (kResultOk != view->attached (reinterpret_cast<void*> (hwnd), Steinberg::kPlatformTypeHWND)) {
|
||||||
assert (0);
|
assert (0);
|
||||||
}
|
}
|
||||||
|
_view_realized = true;
|
||||||
|
|
||||||
ViewRect rect;
|
ViewRect rect;
|
||||||
if (view->getSize (&rect) == kResultOk) {
|
if (view->getSize (&rect) == kResultOk) {
|
||||||
@ -86,7 +87,7 @@ void
|
|||||||
VST3HWNDPluginUI::view_size_allocate (Gtk::Allocation& allocation)
|
VST3HWNDPluginUI::view_size_allocate (Gtk::Allocation& allocation)
|
||||||
{
|
{
|
||||||
IPlugView* view = _vst3->view ();
|
IPlugView* view = _vst3->view ();
|
||||||
if (!view) {
|
if (!view || !_view_realized) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PBD::Unwinder<bool> uw (_resize_in_progress, true);
|
PBD::Unwinder<bool> uw (_resize_in_progress, true);
|
||||||
|
@ -106,7 +106,7 @@ void
|
|||||||
VST3NSViewPluginUI::view_size_allocate (Gtk::Allocation& allocation)
|
VST3NSViewPluginUI::view_size_allocate (Gtk::Allocation& allocation)
|
||||||
{
|
{
|
||||||
IPlugView* view = _vst3->view ();
|
IPlugView* view = _vst3->view ();
|
||||||
if (!view) {
|
if (!view || !_view_realized) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +133,8 @@ VST3NSViewPluginUI::view_size_allocate (Gtk::Allocation& allocation)
|
|||||||
allocation.set_height (rect.bottom - rect.top);
|
allocation.set_height (rect.bottom - rect.top);
|
||||||
#endif
|
#endif
|
||||||
if (view->canResize() == kResultTrue) {
|
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* nsview = gdk_quartz_window_get_nsview (_gui_widget.get_window()->gobj());
|
||||||
[nsview addSubview:_ns_view];
|
[nsview addSubview:_ns_view];
|
||||||
|
_view_realized = true;
|
||||||
_gui_widget.queue_resize ();
|
_gui_widget.queue_resize ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ VST3PluginUI::VST3PluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_pt
|
|||||||
, _req_width (0)
|
, _req_width (0)
|
||||||
, _req_height (0)
|
, _req_height (0)
|
||||||
, _resize_in_progress (false)
|
, _resize_in_progress (false)
|
||||||
|
, _view_realized (false)
|
||||||
{
|
{
|
||||||
_ardour_buttons_box.set_spacing (6);
|
_ardour_buttons_box.set_spacing (6);
|
||||||
_ardour_buttons_box.set_border_width (6);
|
_ardour_buttons_box.set_border_width (6);
|
||||||
@ -55,6 +56,7 @@ VST3PluginUI::VST3PluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_pt
|
|||||||
|
|
||||||
VST3PluginUI::~VST3PluginUI ()
|
VST3PluginUI::~VST3PluginUI ()
|
||||||
{
|
{
|
||||||
|
assert (_view_realized);
|
||||||
_vst3->close_view ();
|
_vst3->close_view ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +58,7 @@ protected:
|
|||||||
int _req_height;
|
int _req_height;
|
||||||
|
|
||||||
bool _resize_in_progress;
|
bool _resize_in_progress;
|
||||||
|
bool _view_realized;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void parameter_update ();
|
void parameter_update ();
|
||||||
|
@ -203,6 +203,7 @@ VST3X11PluginUI::view_realized ()
|
|||||||
if (kResultOk != view->attached (reinterpret_cast<void*> (window), Steinberg::kPlatformTypeX11EmbedWindowID)) {
|
if (kResultOk != view->attached (reinterpret_cast<void*> (window), Steinberg::kPlatformTypeX11EmbedWindowID)) {
|
||||||
assert (0);
|
assert (0);
|
||||||
}
|
}
|
||||||
|
_view_realized = true;
|
||||||
#if 0
|
#if 0
|
||||||
_gui_widget.set_sensitive (true);
|
_gui_widget.set_sensitive (true);
|
||||||
_gui_widget.set_can_focus (true);
|
_gui_widget.set_can_focus (true);
|
||||||
@ -228,7 +229,7 @@ void
|
|||||||
VST3X11PluginUI::view_size_allocate (Gtk::Allocation& allocation)
|
VST3X11PluginUI::view_size_allocate (Gtk::Allocation& allocation)
|
||||||
{
|
{
|
||||||
IPlugView* view = _vst3->view ();
|
IPlugView* view = _vst3->view ();
|
||||||
if (!view) {
|
if (!view || !_view_realized) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PBD::Unwinder<bool> uw (_resize_in_progress, true);
|
PBD::Unwinder<bool> uw (_resize_in_progress, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user