TooltipWindow with multiple instances in Cubase

I am experiencing a problem with TooltipWindow.

I have created a tootipwindow in my plugin, but when I am inserting more than a single instance in a Cubase song, I am getting assertions when closing Cubase.

The first assertion is there : // doh! If you don't delete all your windows before exiting, you're going to // be leaking memory! jassert (desktopComponents.size() == 0);
I am analysing the problem this way : while having mutiple instances, there is a single desktop.
When closing the first instance, the first tooltip window is deleted, but there is still the second instance TooltipWindow lying on the desktop.

Under the debugger I really got the impression that the first instance deletion destroys the Desktop.

Am I wrong ? How could I solve this problem ?

P.S. I am using Juce 1.46

Yes, you’d need to use some kind of singleton that holds the tooltipwindow, and then make sure that it gets deleted, e.g. using DeletedAtShutdown or by reference counting it.

Thanks Jules.

Just a clarification. In this post, chkn wrote about DeleteAtShutdown :

Is this new behaviour present in Juce 1.46 ? (Or may be this is irrelevant)

I can’t remember when that behaviour was added… I guess you’d have to take a look inside the 1.46 wrapper code and see what it does.