Invalid Thread Access on Display.readAndDispatch() (using SWT_AWT) [message #549645] |
Tue, 27 July 2010 12:44 |
Eclipse User |
|
|
|
Originally posted by: hillner.informatik.uni-leipzig.de
Hi all,
I got a really strange problem. I integrated an eclipse plugin into a
native java program. Therefore I started Equinox manually and installed
the required plugins, ...
The plugin which is all about contains a GUI which I put on a JPanel
using the SWT-AWT bridge.
The point is that the UI can be started once within the host program.
when I close the window which contains the SWT-UI (not the whole
program) and try to start it again, the SWT-UI cannot be loaded because
the Display is accessed incorrectly (Invalid Thread Access).
Please see the stack trace below:
--------------------------------------------------
ExceptionClass: class org.eclipse.swt.SWTException
Message: Invalid thread access
StackTrace:
org.eclipse.swt.SWT.error(SWT.java:3777)
org.eclipse.swt.SWT.error(SWT.java:3695)
org.eclipse.swt.SWT.error(SWT.java:3666)
org.eclipse.swt.widgets.Widget.error(Widget.java:463)
org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:355)
org.eclipse.swt.widgets.Shell.getShells(Shell.java:1057)
org.eclipse.swt.widgets.Shell.releaseChildren(Shell.java:119 5)
org.eclipse.swt.widgets.Widget.release(Widget.java:807)
org.eclipse.swt.widgets.Shell.WM_DESTROY(Shell.java:2073)
org.eclipse.swt.widgets.Control.windowProc(Control.java:3800 )
org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:337)
org.eclipse.swt.widgets.Decorations.windowProc(Decorations.j ava:1576)
org.eclipse.swt.widgets.Shell.windowProc(Shell.java:1937)
org.eclipse.swt.widgets.Display.windowProc(Display.java:4541 )
org.eclipse.swt.internal.win32.OS.PeekMessageW(Native Method)
org.eclipse.swt.internal.win32.OS.PeekMessage(OS.java:2880)
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3417)
com.ibm.datatools.explore.multivariate.ui.spss.gui.Attribute sExplorerWindow.openAWT(AttributesExplorerWindow.java:206)
com.ibm.datatools.explore.multivariate.ui.spss.AttributesExp lorerUISPSSPlugin.start(AttributesExplorerUISPSSPlugin.java: 62)
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:1009)
java.security.AccessController.doPrivileged(Native Method)
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1003)
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:984)
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
org.eclipse.osgi.framework.internal.core.AbstractBundle.resu me(AbstractBundle.java:355)
org.eclipse.osgi.framework.internal.core.Framework.resumeBun dle(Framework.java:1074)
org.eclipse.osgi.framework.internal.core.StartLevelManager.r esumeBundles(StartLevelManager.java:616)
org.eclipse.osgi.framework.internal.core.StartLevelManager.i ncFWSL(StartLevelManager.java:508)
org.eclipse.osgi.framework.internal.core.StartLevelManager.d oSetStartLevel(StartLevelManager.java:299)
org.eclipse.osgi.framework.internal.core.StartLevelManager.d ispatchEvent(StartLevelManager.java:489)
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEve nt(EventManager.java:211)
org.eclipse.osgi.framework.eventmgr.EventManager$EventThread .run(EventManager.java:321)
--------------------------------------------------
My code starts a new Thread which loads equinox and starts the target
plugin. Maybe the loader thread is the problem when trying to access the
display but I can't load the platform in the same thread like the
application, in this case the UI won't come up.
The strange thing is that the Exception is thrown in the code below and
only when executing the component the second time (equinox is shut down
every time the host window was closed).
while(!shell.isDisposed()) {
if(!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
Does anyone have an idea how to fix it?
Thanks,
Stanley
|
|
|
Powered by
FUDForum. Page generated in 0.03169 seconds