Hi, in my application i sometimes need to open an instance of the following class which hosts an editor of an AudioPluginInstance.
Everything works fine until i close the application where i always get the following warning:
*** Leaked objects detected: 1 instance(s) of class NSViewAttachment
JUCE Assertion failure in juce_LeakedObjectDetector.h:97
Closing the window directly works on first sight but when closing the application i also get that warning, therefore something is not cleaned up correctly around the editor i guess.
How can i correctly clean and close that desktop window too? Thanks for any hints.
class PresetsListComponent::SynthWindow : public DocumentWindow
{
public:
SynthWindow (PresetsListComponent& owner_, ScopedPointer<AudioPluginInstance> instance_)
: DocumentWindow ("", Colours::lightgrey, DocumentWindow::allButtons),
owner (owner_),
instance(instance_)
{
auto editor = instance->createEditor();
auto bc = editor->getConstrainer();
Component* component = new Component();
component->addAndMakeVisible (editor);
component->setBounds(0, 0, bc->getMinimumWidth(), bc->getMinimumHeight());
setContentOwned(component, true);
setResizable(false, false);
setVisible (true);
}
~SynthWindow()
{
clearContentComponent();
}
void closeButtonPressed()
{
owner.synthWindow = nullptr;
}
private:
PresetsListComponent& owner;
ScopedPointer<AudioPluginInstance> instance;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SynthWindow)
};
