I have a plugin with an editor, the editor has:
[code]class MyProcessorEditor : …
tooltipWindow = new TooltipWindow(this);
Which gets created at construction of the editor. When I open two instances of the plugin (tried in cubase and bidule) and hover over a control in one window a tooltip appears in both windows.
Anyone have any ideas?
It does look like this has to do with multiple instances of the TooltipWindow. It would be nice to have a guide on how to use TooltipWindow’s in plugins.
There is one ancient thread about using either reference counting or DeleteAtShutdown + singleton on here, but it’s not very enlightening.
This kind of does the trick, let’s see if Jules accepts this…
m_TooltipWindow = new TooltipWindow();
if (--m_RefCount == 0)
static TooltipWindow* m_TooltipWindow;
static Atomic<int> m_RefCount;
TooltipWindow* ReferenceCountedTooltipWindow::m_TooltipWindow = nullptr;
Atomic<int> ReferenceCountedTooltipWindow::m_RefCount = 0;
Jules, I guess it would be nice to have something like this in the code and some kind of comment about multiple instances?
Yes, I should add a note about having multiple instances. Personally, I’d probably have just used a static ref-counted pointer, but your code will work too.
static ref-counted pointer <- isn’t that what my code is?
Sorry, I just meant I’d have used ReferenceCountedObjectPtr to hide the implementation details.