Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Display.java1
-rw-r--r--tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/widgets/Display_Test.java19
2 files changed, 20 insertions, 0 deletions
diff --git a/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Display.java
index ad6cbbb4dd..26aa76130a 100644
--- a/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Display.java
@@ -730,6 +730,7 @@ public class Display extends Device implements Adaptable {
}
private void runDisposeExecs() {
+ checkDevice();
if( disposeList != null ) {
for( int i = 0; i < disposeList.length; i++ ) {
if( disposeList[ i ] != null ) {
diff --git a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/widgets/Display_Test.java b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/widgets/Display_Test.java
index 7f5e18b46b..7b3dc7855c 100644
--- a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/widgets/Display_Test.java
+++ b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/widgets/Display_Test.java
@@ -1405,6 +1405,25 @@ public class Display_Test extends TestCase {
assertNull( display.getActiveShell() );
}
+ public void testDisposeFailsWhenInDisposal() {
+ // See bug 389384
+ Fixture.fakePhase( PhaseId.PROCESS_ACTION );
+ final Display display = new Display();
+ Shell shell = new Shell( display );
+ shell.addDisposeListener( new DisposeListener() {
+ public void widgetDisposed( DisposeEvent event ) {
+ display.dispose();
+ }
+ } );
+
+ try {
+ display.dispose();
+ fail();
+ } catch( SWTException exception ) {
+ assertEquals( "Device is disposed", exception.getMessage() );
+ }
+ }
+
private static void setCursorLocation( Display display, int x, int y ) {
IDisplayAdapter adapter = display.getAdapter( IDisplayAdapter.class );
adapter.setCursorLocation( x, y );

Back to the top