javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/BaseCSSEngine.java
changeset 35 85266cc22c7f
parent 21 2a9601315dfc
child 76 4ad59aaee882
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/BaseCSSEngine.java	Thu May 27 12:49:31 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/BaseCSSEngine.java	Fri Jun 11 13:33:44 2010 +0300
@@ -38,7 +38,7 @@
 	public BaseCSSEngine(Display display){
 		if (display == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
 		if (display.isDisposed ()) SWT.error (SWT.ERROR_INVALID_ARGUMENT);
-		if (Display.getCurrent() == null ) SWT.error (SWT.ERROR_THREAD_INVALID_ACCESS);
+		if (display.getThread() != Thread.currentThread()) SWT.error (SWT.ERROR_THREAD_INVALID_ACCESS);
 		this.parent = display;
 	}
 
@@ -145,12 +145,14 @@
 	 *
 	 */
 	public void dispose(){
-		if (Display.getCurrent() == null ) SWT.error (SWT.ERROR_THREAD_INVALID_ACCESS);
-		parent = null;
+		if(parent != null) {
+			if (parent.getThread() != Thread.currentThread()) SWT.error (SWT.ERROR_THREAD_INVALID_ACCESS);
+			parent = null;
+		}
 	}
 
 	private void checkEngine(){
 		if ( parent == null || parent.isDisposed() ) SWT.error( SWT.ERROR_WIDGET_DISPOSED);
-	    if (Display.getCurrent() == null ) SWT.error (SWT.ERROR_THREAD_INVALID_ACCESS);
+	    if ( parent.getThread() != Thread.currentThread() ) SWT.error (SWT.ERROR_THREAD_INVALID_ACCESS);
 	}
 }