setAlwaysOnTop(true) crash VST host on exit (Mac only)


#1

Dear community,

Please help me with the following problem on Mac. Introjucer generated VST plugin, add a button (or any other control) to the desktop, call setAlwaysOnTop(true), close VST host (tried Cubase and another one) and it will crash. Code is simple as ABC:

JuceFreshPluginAudioProcessorEditor::JuceFreshPluginAudioProcessorEditor (JuceFreshPluginAudioProcessor& p)
    : AudioProcessorEditor (&p), processor (p), m_Button("*",  DrawableButton::ImageOnButtonBackground)
{
    m_Button.addToDesktop(ComponentPeer::windowIsTemporary, 0);
    m_Button.setBounds(100, 100, 200, 100);
    m_Button.setVisible(true);
    m_Button.setOpaque(false);
    m_Button.setAlwaysOnTop(true);
    setSize (400, 300);
}

If you comment out last setAlwaysOnTop(true) - it works fine. Happens on Mac, works on Windows. Other components give the same result, not only DrawableButton. Tried removeFromDesktop() and setAlwaysOnTop(false) in destructor of Editor - doesn't help. Button needed to be on top of all plugin windows, so can't just leave it out..

Please help, hope it's not that difficult.

Victor


#2

You really don't need to do that, and shouldn't when making plugins!

It's entirely up to the host (and user of such) to bring up your plugin's editor, and you're very likely messing with any host bringing up something as heavyweight as this. (I'm sure someone can give elaborate details as to why)

Keep it simple: leave out the call to addToDesktop() (and maybe even setAlwaysOnTop()).


#3

Doing a quick search in the JUCE forums here brings up some useful information:

http://www.juce.com/forum/topic/setalwaysontoptrue-pluginwindow

#4

Thank you for useful information!

Reason for setAlwaysOnTop is the following: I'm creating a TypeAhead editbox, where I want TextEditor to be focused component, and dropdown ListBox with all the suggestions appear on top of everything else. Sometimes it should extend parent window's borders. It can't be child of a window because of that, and it should be on top because plugin windows are usually on top. And it can't be popup menu because I need focus in TextEditor.

I'll try release builds tomorrow, to see if they crash..

Maybe it's possible to close this ListBox before destruction of plugin window? Or any other details or suggestions are appreciated. Everything works so good on Win, will be a frustration if Mac won't work (

Once again, thank you guys, I keep digging it..