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

Bug 335609

Summary: ToolTipHelper causing application hangs
Product: [Tools] GEF Reporter: Lidija Grahek <lgrahek>
Component: GEF-Legacy Draw2dAssignee: Lidija Grahek <lgrahek>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aboyko, ahunter.eclipse, hudsonr
Version: unspecified   
Target Milestone: 3.6.2 (Helios SR2)   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch wayne.beaton: iplog+

Description Lidija Grahek CLA 2011-01-27 15:33:09 EST
displayToolTipNear(...) method in ToolTipHelper uses Timer to schedule expiration. However, canceling is done within Display.getDefault().syncExec(...), and it sometimes happens that two threads wait on each other causing a hang. This can be easily fixed by changing syncExec to asyncExec. Note that this code that involves syncExec hasn't changed in a while, but there were some jdk changes (in Timer class) that seem to expose the problem in this case. 

The fix is attached.
Comment 1 Lidija Grahek CLA 2011-01-27 15:34:14 EST
Created attachment 187773 [details]
Patch
Comment 2 Randy Hudson CLA 2011-01-27 15:43:54 EST
Even better would be to avoid using Timer, since it spawns a new thread.  It turns out SWT supports timers already:


Display.getDefault().timerExec(5000, new Runnable()...)
Comment 3 Anthony Hunter CLA 2011-01-28 15:23:19 EST
(In reply to comment #1)
> Created attachment 187773 [details]
> Patch

Reviewed with Alex Boyko and he agrees so committed to R3_6_maintenance and HEAD.