AU Plugin crash, debugger traces it to findColour, getWidth/Height, etc

So I was able to get my plugin code to a point where it successfully builds. I opened Logic Pro X, attaching a debugger to it via Xcode. I was able to get the plugin editor window to show, but when I click the ‘Settings’ button I had put in it, all heck breaks loose. Each time, the debugger traced it back to JUCE module code, not my code. I have a feeling I’m doing something wrong, because I’m sure if JUCE was this buggy normally, there’d be more talk about it.

  • Initially had the settings window constructor call DocumentWindow constructor with findColour(DocumentWindow::backgroundColourId), but that caused a crash traced back to some internal String function, so I changed it to Colours::grey, as an interim solution.

  • In the same constructor, I started with the line centreWithSize (300, 300); which caused the same crash, this time traced to a call of Rectangle<int>::getHeight() or getWidth() or something. Interim solution was to just comment the line out for now.

  • In my window’s resized() function, it crashed, again, traced back to Rectangle<int>::getWidth() This was my latest debug session. A screenshot of it can be found in the “crash logs” folder of the source repo, found here: https://github.com/NebuHiiEjamu/CinemixAutomationBridge

Thanks for everyone’s support! I really appreciate it.

You should always set the size of windows/components as last thing, especially, if it contains sub components. I am assuming, you have sub components created in unique_ptr’s, but only after the setSize.

Any call to setSize/setBounds etc. cause a synchronous call to resized(), where you try to set bounds to the not yet created sub components.

1 Like

That would explain a lot, actually. Thanks! Hopefully that’s the end of it.

1 Like