Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Exception in thread "AWT-AppKit" org.eclipse.swt.SWTException: Invalid thread access(How do I get around this error?)
Exception in thread "AWT-AppKit" org.eclipse.swt.SWTException: Invalid thread access [message #718671] Thu, 25 August 2011 02:45 Go to next message
Bill Swanson is currently offline Bill SwansonFriend
Messages: 13
Registered: April 2011
Junior Member
Exception in thread "AWT-AppKit" org.eclipse.swt.SWTException: Invalid thread access

This error is on a Mac 10.4, Eclipse 3.6.2, swt.carbon.macosx_3.6.2v3659b.jar. Does anyone have a solution for this error when running a stand alone jar?


Re: Exception in thread "AWT-AppKit" org.eclipse.swt.SWTException: Invalid thread access [message #718945 is a reply to message #718671] Thu, 25 August 2011 16:22 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1351
Registered: July 2009
Senior Member
Wrap the call in a Display.asyncExec() call.
Re: Exception in thread "AWT-AppKit" org.eclipse.swt.SWTException: Invalid thread access [message #721901 is a reply to message #718945] Sat, 03 September 2011 13:54 Go to previous messageGo to next message
Bill Swanson is currently offline Bill SwansonFriend
Messages: 13
Registered: April 2011
Junior Member
Wrapping the code with:
Dispay.getDefault().syncExecExec(new Runnable(){
        public void run(){
           ...code here
        }
    });
works. But after reading from a file in code, I am getting an invalid thread access error at org.eclipse.swt.widgets.Display.mouseHoverProc(Unknown Source). I have wrapped the MouseHover and MouseEnter events with the above call which solved a few errors. But the file access call brings up the error on mouseHoverProc. Any suggestions or ideas?

Re: Exception in thread "AWT-AppKit" org.eclipse.swt.SWTException: Invalid thread [message #722230 is a reply to message #721901] Mon, 05 September 2011 06:13 Go to previous message
Eclipse UserFriend
Originally posted by:

On 2011-09-03 15:54, Bill Swanson wrote:
> Wrapping the code with:
> Dispay.getDefault().syncExecExec(new Runnable(){
> public void run(){
> ...code here
> }
> });works.

I'm not sure what kind of typo "syncExecExec" is supposed to be, but
please use "asyncExec" instead of "syncExec", if you can. Using the
latter gives you more chances of a dead lock.

> But after reading from a file in code, I am getting an invalid
> thread access error at
> org.eclipse.swt.widgets.Display.mouseHoverProc(Unknown Source). I have
> wrapped the MouseHover and MouseEnter events with the above call which
> solved a few errors. But the file access call brings up the error on
> mouseHoverProc. Any suggestions or ideas?

Yes: You need to devide your code into clear AWT and clear SWT zones. If
you switch the border between both, use Display#asyncExec to tunnel from
AWT to SWT and use EventQueue#invokeLater to tunnel from SWT to AWT.

HTH & GReetings from Bremen,

Daniel Kr├╝gler
Previous Topic:How to use Progress-Bar widget in eclispe rcp
Next Topic:style support by button widget
Goto Forum:
  


Current Time: Sat Dec 20 05:29:18 GMT 2014

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

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