Two plugin Instances, same ToolTip

So, my plugin (PolarDesigner3) allows multiple instances of the plugin to be created and ‘synchronized’ through a sync channel, in order that multiple microphones placed in the recording session can have the same settings, as needed by the producer.

I recently added a ‘feature’ that gives me the specifics for the plugin build version (git hash) as well as the unique ‘memory address’ of the plugin - handy for debugging purposes in order to differentiate between different instances of the same plugin. (Discussion in this thread: Getting Unique ID per-plugin Instance?: - #5 by ibisum)

I just recently ran into the situation described in this code comment within the JUCE sources in juce_TooltipWindow.cpp:138 (Note: JUCE 7.0.13)

// Looks like you have more than one TooltipWindow showing the same tip..
// Be careful not to create more than one instance of this class with the
// same parent component!

Before I go into ripping out my fancy toolTip, I was wondering if anyone knew of a quick fix for this situation. The thing is, the toolTip text should be unique - as each Plugin instance is formulating the toolTip text based on the Git Hash, Plugin Version, and memory address of the PluginEditor, so it should be unique… however I’m hitting the assert.

Any quick fix to this besides refactoring my UI to have programmer-friendly details hidden somewhere else in the UI … ?

What exactly causes the assertion to fire? Does it only happen when you have more than one copy of the plugin editor open? Do you have more than one tooltip window sharing the same parent component, or are you putting all tooltips on the desktop? If you’re putting tooltips on the desktop, are you using a SharedResourcePointer to share the tooltip window between all instances of the plugin?

Looking at the code, I think the comment might be a bit misleading - I don’t think the tooltip text is checked, so this might fire if there are two tooltips with different text showing in the same parent. That still seems like a problem, though - multiple overlapping tooltips will look ugly and unreadable.

Its very weird because earlier today I used this toolTip to display the BuildID, Version, and “pointer to AudioProcessorEditor”, as a way to differentiate between two different plugin instances while debugging … and I definitely got different tooltip texts for both instances, and didn’t reach this assert.

Then, I did a full rebuild and now it crashes at the lines given.

I’ll dig into this a bit further and come back with more details when I work out just wtf is going on … my understanding though, is that both plugin instances should have unique windows and thus unique tooltips with different text (because the %p to AudioProcessorEditor is different), and this assert condition should not apply.

Following up on this, updating here for anyone who hits this … and I found the dumb bug - I had a TooltipWindow declared in my Editor class, but it was ‘orphaned’, i.e. had no parent component, or in other words its parent was null_ptr - and when there were multiple instances, all having the same TooltipWindow with the null_ptr parent, this triggered the assertion. So:

// this was the solution to add to the Editor constructor
addAndMakeVisibile(toolTipWindow); 

… and tooltips now work properly across multiple instances of the same plugin …

1 Like

Thanks! I had to do this as well as make it a shared resource pointer: