Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to handle An Invalid Thread Access Exception?
How to handle An Invalid Thread Access Exception? [message #443115] Sat, 18 September 2004 21:18 Go to next message
Eclipse UserFriend
Originally posted by: bharh.cc.gatech.edu

Hello,

I might have posted this message earlier, but since I cannot see it in the
newsgroup I am posting it again. Sorry if you see the same message twice.

I have been trying to understand what is the reason and how to handle
invalid thread access exception, but have had no luck.

I am calling a function from one plug-in to another plug-in (both the
plug-ins are running at the same time and one is dependent on another).
However, when I call the function it gives me Invalid Thread access
exception. This is what I am doing in my function:

Display display = new Display();
Shell shell = new Shell(display);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;
shell.setLayout(gridLayout);
...
//add buttons to the layout
...
shell.pack();
shell.open():
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}

I am not sure where the error occurs, but I believe it is right when I am
trying to create new Display. I have tried using syncExec and asyncExec
but I guess I don't know how to use them correctly because they are not
working either.

Could anyone please provide me or guide me to a concrete example that will
tell me how exactly to make this work.

Thanking you in advance,

Bharti Agarwal
Re: How to handle An Invalid Thread Access Exception? [message #443571 is a reply to message #443115] Tue, 28 September 2004 14:55 Go to previous message
Balaji Kandan is currently offline Balaji KandanFriend
Messages: 20
Registered: July 2009
Junior Member
you might want to look at 'threading issues' document in eclipse help.

balaji

"Bharti Agarwal" <bharh@cc.gatech.edu> wrote in message
news:cii8mm$e62$1@eclipse.org...
> Hello,
>
> I might have posted this message earlier, but since I cannot see it in the
> newsgroup I am posting it again. Sorry if you see the same message twice.
>
> I have been trying to understand what is the reason and how to handle
> invalid thread access exception, but have had no luck.
>
> I am calling a function from one plug-in to another plug-in (both the
> plug-ins are running at the same time and one is dependent on another).
> However, when I call the function it gives me Invalid Thread access
> exception. This is what I am doing in my function:
>
> Display display = new Display();
> Shell shell = new Shell(display);
> GridLayout gridLayout = new GridLayout();
> gridLayout.numColumns = 3;
> shell.setLayout(gridLayout);
> ..
> //add buttons to the layout
> ..
> shell.pack();
> shell.open():
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch()) display.sleep();
> }
>
> I am not sure where the error occurs, but I believe it is right when I am
> trying to create new Display. I have tried using syncExec and asyncExec
> but I guess I don't know how to use them correctly because they are not
> working either.
>
> Could anyone please provide me or guide me to a concrete example that will
> tell me how exactly to make this work.
>
> Thanking you in advance,
>
> Bharti Agarwal
>
Previous Topic:possible to activate cellEditor after doubleClick
Next Topic:Setup SashForm so that resize grows only one side
Goto Forum:
  


Current Time: Wed Sep 25 08:04:28 GMT 2024

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

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

Back to the top