I’d like to show an alert window to the user to tell him that there are unsaved changes. I’d need 3 buttons to achieve that. Here’s my code:
ScopedPointer<AlertWindow> alertWindow = new AlertWindow("Save changes to the current project?", "The current project has unsaved changed that will be lost if you don't save them.", AlertWindow::InfoIcon); alertWindow->addButton("Save and Continue", 0); alertWindow->addButton("Cancel", 1); alertWindow->addButton("Discard Changes", 2); alertWindow->setUsingNativeTitleBar(true); int result = alertWindow->runModalLoop();
The program crashes at the first line after the constructor when trying to add the first button.
*** Dangling pointer deletion! Class: KeyPress JUCE Assertion failure in juce_LeakedObjectDetector.h:64
I don’t understand why this is. It appears to be about the KeyPress the addButton function has as separate pre-defined arguments (shortCutKey1 and shortCutKey2).
Grateful for all insights!