I have an Audio Unit plugin with no editor that loads a VST plugin and returns its editor to the DAW (in createEditor).
When I try to resize this editor, my plugin crashes at juce_VST_Wrapper.mm::setNativeHostWindowSize:
if (NSView* hostView = (NSView*) window) { const int dx = newWidth - component->getWidth(); const int dy = newHeight - component->getHeight(); NSRect r = [hostView frame]; - CRASHES HERE r.size.width += dx; r.size.height += dy; r.origin.y -= dy; [hostView setFrame: r]; }
From what I can see, the window NSView* first receives its value during the first call to createEditor, in the following line of juce_VST_Wrapper.cpp (ptr is the pointer to that NSView*):
hostWindow = attachComponentToWindowRef (editorComp, ptr, useNSView);
But after a while, during startup, the timerCallback of AutoResizingNSViewComponentWithParent in juce_audio_processors.cpp is called, changing it:
void timerCallback() override { if (NSView* child = getChildView()) { stopTimer(); setView (child); } }
But I can't see the hostWindow in VST_Wraper getting updated. Could this be the reason?
I'm really grasping at straws here, any help will be greatly appreciated.
Using OS X 10.9 / XCode 5.