Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Invalid Thread Access on Display.readAndDispatch() (using SWT_AWT)
Invalid Thread Access on Display.readAndDispatch() (using SWT_AWT) [message #549645] Tue, 27 July 2010 12:44
Eclipse UserFriend
Originally posted by:

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
org.eclipse.swt.widgets.Shell.releaseChildren( 5)
org.eclipse.swt.widgets.Control.windowProc( )
org.eclipse.swt.widgets.Decorations.windowProc(Decorations.j ava:1576)
org.eclipse.swt.widgets.Display.windowProc( )
org.eclipse.swt.internal.win32.OS.PeekMessageW(Native Method)
org.eclipse.swt.widgets.Display.readAndDispatch( :3417) sExplorerWindow.openAWT( lorerUISPSSPlugin.start( 62)
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run( Method)
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(
org.eclipse.osgi.framework.internal.core.AbstractBundle.resu me(
org.eclipse.osgi.framework.internal.core.Framework.resumeBun dle(
org.eclipse.osgi.framework.internal.core.StartLevelManager.r esumeBundles(
org.eclipse.osgi.framework.internal.core.StartLevelManager.i ncFWSL(
org.eclipse.osgi.framework.internal.core.StartLevelManager.d oSetStartLevel(
org.eclipse.osgi.framework.internal.core.StartLevelManager.d ispatchEvent(
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEve nt(
org.eclipse.osgi.framework.eventmgr.EventManager$EventThread .run(

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()) {

Does anyone have an idea how to fix it?

Previous Topic:Possible bug during verify event
Next Topic:Treeviewer/-column, celleditor
Goto Forum:

Current Time: Mon Dec 16 12:24:24 GMT 2019

Powered by FUDForum. Page generated in 0.01723 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top