Tooltip crash



We have the problem, that the tooltips randomly crash the whole application. They are working as desired for some time but then the whole app crashes. I added screenshots from Visual Studio showing the whole callstack and some of the local variables. It looks like the whole ComponentPeer is invalid. We didn't delete anything and we can reproduce the error just by moving over the Components with tooltips.

Any help is apreciated.



After some debugging it looks like it is possible, that TooltipWindow::hideTip() can be triggered while TooltipWindow::displayTip() is executed. This happens if you manage to reach the area where the tooltip will be displayed while TooltipWindow::displayTip() is executed. The bounds are updated and Windows fires a mouse enter event which causes the TooltipWindow::mouseEnter() method to hide the tooltip.

See attached screenshot for the stacktrace. 

Going to fix this with a SpinLock where a tryEnter in hideTip() fails and a flag is set, that displayTip() will hide it right after showing.


PS: We can reproduce this bug with Win 7, not sure about other Windows versions. Mac isn't affected.

Not sure what you mean about the lock  - like all GUI classes, none of the tooltip stuff is thread-safe so you mustn't use it from a background thread.

It isn't used from a background thread. It is a crash in the JUCE code where in some circumstances hideTip() will be called within displayTip(). It has to be checked if hideTip() is actually allowed to hide the tip and call Component::removeFromDesktop() which deletes the ComponentPeer.

Because if you don't check it, the peer will be deleted and displayTip() will crash like shown in the screenshots above.

I did my debugging with a SpinLock -even though everything is in the same thread-, but a simple boolean should do the trick too.

Thanks, I've added some code to avoid recursive calls now.