I have a desktop JUCE application that uses a subclass of UndoManager to handle undo/redo functionality across the app. This works fine, but upon exiting the app I get a JUCE LeakDetector exception saying that between 2-6 instances of OwnedArray have been leaked.
The UndoManager subclass is implemented as a ‘magic static’ singleton, the constructor is private and everything that takes an UndoManager pointer throughout the app accesses it like so:
// == in the header within the RUndoManager class
static UndoManager* get();
//== in the .cpp file
UndoManager* RUndoManager::get()
{
static RUndoManager manager;
return &mananger;
}
Is there something that needs to be handled in a custom destructor for this to get cleaned up correctly? I don’t know where the particular leaked OwnedArray instances are coming from, so I guess it must be something internal to the UndoManager instance? Any help appreciated!
