AU without GUI crashes


#1

Hi Jules,

I downloaded the tip yesterday from GitHub and noticed that an AU crashes if no GUI is present (e.g. if createEditor() returns nullptr).

The current code is this (line 1235 in juce_AU_Wrapper.mm):

if (juceFilter != nullptr)
{
  deleteUI();

  AudioProcessorEditor* editorComp = juceFilter->createEditorIfNeeded();
  editorComp->setOpaque (true);
  windowComp = new ComponentInHIView (editorComp, mCarbonPane);
}

Which should be changed to something like this:

if (juceFilter != nullptr && juceFilter->hasEditor())
{
  deleteUI();

  AudioProcessorEditor* editorComp = juceFilter->createEditorIfNeeded();
                
  if (editorComp != nullptr)
  {
    editorComp->setOpaque (true);
    windowComp = new ComponentInHIView (editorComp, mCarbonPane);
  }
}

The plugin won’t crashes then, but still creates an empty window. I haven’t looked closer whether current AUs won’t allow a plugin without GUI or whether additional steps are necessary to signal the host the it has to supply the interface.

Edit: The blank window appears in Reaper but not in Logic, so I assume it is a reaper issue.

Chris


#2

Drat. That code was written to assume that the host wouldn't call CreateUI if the plugin is gui-less, but I guess I need to make sure it can survive being called - thanks!

BTW.. Tip for C++ ninjas: whenever you see a statement like that, you should get into the habit of always writing it this way:

if (AudioProcessorEditor* editorComp = juceFilter->createEditorIfNeeded())
{
    editorComp->setOpaque (true);
    windowComp = new ComponentInHIView (editorComp, mCarbonPane);
}

(..reasons why explained in the juce coding standard pages!)