Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 402105

Summary: jface ToolTip shell listeners can be leaked when a different control hides the tooltip.
Product: [Eclipse Project] Platform Reporter: Chris Simmons <cps>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 Keywords: helpwanted
Version: 3.7.2   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: stalebug

Description Chris Simmons CLA 2013-03-01 04:57:46 EST
Whenever a ToolTip is open the ToolTip does this

control.getShell().addListener(SWT.Deactivate, shellListener);

Whenever a ToolTip is hidden it removes the listener.

control.getShell().removeListener(SWT.Deactivate, shellListener);

However this doesn't work reliably because two different instances of ToolTip can interact via the static CURRENT_TOOLTIP like this:-

1) ToolTip A shows a tooltip for contol X
2) ToolTip B decides to show a tooltip for control Y

When this happens A will have hooked a listener to X's shell and B will try to remove its listener from Y's shell - but B hasn't registered a listener!  At this point A's listener is leaked.

Its not a simple as always removing the listener when the ToolTip is disposed as the above can happen multiple times resulting in multiple leaks.

I think the correct fix is to instead add a dispose listener on the tooltip shell (i.e. CURRENT_TOOLTIP) when it is created and move the clean up code from the toolTipHide method into the dispose listener.
Comment 1 Lars Vogel CLA 2019-11-27 07:21:11 EST
This bug hasn't had any activity in quite some time. Maybe the problem got
resolved, was a duplicate of something else, or became less pressing for some
reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it.
The information can be, for example, that the problem still occurs, that you
still want the feature, that more information is needed, or that the bug is
(for whatever reason) no longer relevant.

If the bug is still relevant, please remove the stalebug whiteboard tag.