addToDesktop Crash in Logic X

anytime i open a DialogWindow and call addToDesktop inside of it in logic x i get a crash. this happens with both au and auv3 (although the standalone auv3 app runs fine, as do the vst/vst3 plugins in other hosts).

i’m opening a window like so from a mousedown handler:

DialogWindow::LaunchOptions o;

o.content.setOwned (new WaveshapeLibrarianComponent(processor));
o.content->setSize (900, 300);

o.dialogTitle                   = TRANS("Group") + String().formatted(" #%d ", (int) id + 1);
o.dialogBackgroundColour        = o.content->getLookAndFeel().findColour (ResizableWindow::backgroundColourId);
o.escapeKeyTriggersCloseButton  = true;
o.useNativeTitleBar             = false;
o.resizable                     = false;

in the window i called this for a reason that i can’t remember now:


and this is the stack trace i get:

Application Specific Information:
Crashing on exception: <NSRendezvousFreeWindowController: 0x600000358e00> is supposed to have retained <JUCEWindow_99deb0b5e9be63b7: 0x7fde9f6186f0>, so the latter cannot possibly deallocate

Application Specific Backtrace 1:
0   CoreFoundation                      0x00007fff3e29dcf9 __exceptionPreprocess + 256
1   libobjc.A.dylib                     0x00007fff68e32a17 objc_exception_throw + 48
2   CoreFoundation                      0x00007fff3e2b8a16 +[NSException raise:format:arguments:] + 98
3   Foundation                          0x00007fff4054ae11 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
4   ViewBridge                          0x00007fff65fbeace -[NSWindow(ViewBridgeSwizzle) swizzledOrderWindow:relativeTo:] + 448
5   AppKit                              0x00007fff3c153134 -[NSWindow _finishClosingWindow] + 472
6   AppKit                              0x00007fff3bbebc75 -[NSWindow _close] + 364
7   My Plugin                           0x000000010f3115a2 _ZN4juce19NSViewComponentPeerD2Ev + 242
8   My Plugin                           0x000000010f30fd8e _ZN4juce19NSViewComponentPeerD0Ev + 14
9   My Plugin                           0x000000010f2bc9e3 _ZN4juce9Component17removeFromDesktopEv + 147
10  My Plugin                           0x000000010f2c4f42 _ZN4juce9Component17addChildComponentERS0_i + 98
11  My Plugin                           0x000000010f1bac02 _ZN13ListComponentC2ER32InstrumentDesignerAudioProcessorb + 690
12  My Plugin                           0x000000010f18142b _ZN19WaveshaperComponent9mouseDownERKN4juce10MouseEventE + 1419

i’m currently using master. any ideas what’s happening here?

updated: i narrowed this down to the addToDesktop call.

there are a ton of threads that say “do not use modal dialog windows in your plugin”.

the easiest way around this is to just add a child to your top level editor component that IS the popup window you want, and make it sit on top of the rest of your plugin GUI as long as its needed, blocking all of your other GUI elements.

the same what @matkatmusic says, but if you really need a second window you might want to just open it (which will at least work at mosts hosts), and design it not to work in a modal way.

EDIT: This maybe doesn’t work in AUv3!

1 Like

so i followed advice from another thread:

and pulled pieces out until i found the root cause (which in retrospect is more obvious from the stack trace):


removing this line removes the crash, i’ll update the topic and the initial description.

1 Like