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

Bug 389384

Summary: Calling Display#dispose() during disposal of the display should throw SWT exception
Product: [RT] RAP Reporter: Ralf Sternberg <rsternberg>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: 2.0   
Target Milestone: 2.0 M2   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Ralf Sternberg CLA 2012-09-12 05:15:38 EDT
It's illegal to call Display#dispose() during the disposal of the display (in a dispose listener). In SWT, a "Widget is disposed" exception is thrown in this case.

In RWT, this leads to a scary exception as shown below. We should also throw the appropriate SWT exception instead.
We could do so by adding a checkDevice() call to Display#release.

Current exception:
java.lang.NullPointerException
    at org.eclipse.swt.widgets.Synchronizer.removeFirst(Synchronizer.java:145)
    at org.eclipse.swt.widgets.Synchronizer.releaseSynchronizer(Synchronizer.java:127)
    at org.eclipse.swt.widgets.Display.release(Display.java:688)
    at org.eclipse.swt.graphics.Device.dispose(Device.java:287)
...
Comment 1 Ralf Sternberg CLA 2012-09-17 05:39:19 EDT
Fixed by adding a checkDevice in Display.runDisposeExecs, commit 00c77bd7c2c1c3be175a8d3c4dec538d5955a8c3.