Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Invalid thread access from SWT
Invalid thread access from SWT [message #90087] Mon, 26 May 2008 17:57 Go to next message
Markus  rüger is currently offline Markus rügerFriend
Messages: 369
Registered: July 2009
Senior Member
Hi,
I get an invalid thread access exepction from SWT as I call refresh on my
table viewer. I use the following code that is inside a listener that
listens for changes of my model:

DUMMY.addSaveListener(new ISaveListener(){
public void saved() {
Job refreshJob = new UIJob(""){
public IStatus runInUIThread(IProgressMonitor monitor) {
monitor.beginTask("Refreshing...", 1);
refresh();
monitor.done();
return Status.OK_STATUS;
}

};
refreshJob.setUser(true);
refreshJob.schedule();
}
public void savedApplKindPauschData() {
}
});

public void refresh() {
if(!viewer.getTable().isDisposed())
viewer.refresh();
}

Regards,
Markus
Re: Invalid thread access from SWT [message #90117 is a reply to message #90087] Mon, 26 May 2008 18:02 Go to previous messageGo to next message
Markus  rüger is currently offline Markus rügerFriend
Messages: 369
Registered: July 2009
Senior Member
I might need to add, that this only happens in IE (i use IE7), not in
FireFox!?


"Markus Kr
Re: Invalid thread access from SWT [message #90607 is a reply to message #90117] Wed, 28 May 2008 22:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

Markus,

I couldn't reproduce what you describe. I changed the WorkbenchDemo
by adding a UIJob that refreshes a viewer.
Could you provide a standalone snippet that reproduces the behavior?

Cheers
Rüdiger


Markus Krüger wrote:
> I might need to add, that this only happens in IE (i use IE7), not in
> FireFox!?
>
>
> "Markus Krüger" <krueger@ion.ag> schrieb im Newsbeitrag
> news:g1eti7$tnt$1@build.eclipse.org...
>> Hi,
>> I get an invalid thread access exepction from SWT as I call refresh on my
>> table viewer. I use the following code that is inside a listener that
>> listens for changes of my model:
>>
>> DUMMY.addSaveListener(new ISaveListener(){
>> public void saved() {
>> Job refreshJob = new UIJob(""){
>> public IStatus runInUIThread(IProgressMonitor monitor) {
>> monitor.beginTask("Refreshing...", 1);
>> refresh();
>> monitor.done();
>> return Status.OK_STATUS;
>> }
>>
>> };
>> refreshJob.setUser(true);
>> refreshJob.schedule();
>> }
>> public void savedApplKindPauschData() {
>> }
>> });
>>
>> public void refresh() {
>> if(!viewer.getTable().isDisposed())
>> viewer.refresh();
>> }
>>
>> Regards,
>> Markus
>>
>
>
Re: Invalid thread access from SWT [message #90789 is a reply to message #90607] Thu, 29 May 2008 10:31 Go to previous messageGo to next message
Markus  rüger is currently offline Markus rügerFriend
Messages: 369
Registered: July 2009
Senior Member
Hi R
  • Attachment: bugpatch.txt
    (Size: 6.57KB, Downloaded 191 times)
Re: Invalid thread access from SWT [message #90975 is a reply to message #90789] Fri, 30 May 2008 07:46 Go to previous message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

Hi Markus,

I can reproduce the invalid thread access. It occurs regardless
which browser is used.

To work around the issue you could wrap the UI code like this:
UICallBack.runNonUIThreadWithFakeContext( display, new Runnable()
{
public void run() {
refresh();
}
});

Currently I think this shouldn't be necessary. The fake-context
should be provided under the hood. But we need to investigate this
more thoroughly.

I filed bug 234779 to track and discuss this issue.

Cheers,
Rüdiger

Markus Krüger wrote:
> Hi Rüdiger,
>
> to reproduce apply the attached path to your demo. This patch adds and
> activator with my simple save listener and a dummy save method that fires
> the listeners when called. The FooEditor calls this save method on save. The
> DemoTableViewPart registers a save listener and wants to refresh on save.
>
> Now start the demo and call it with IE7 (may be IE6 will raise the bug, too,
> but I hove not tested). Open the FooEditor and add some changes and save it.
> You will see an error and the console states an invalid thread access
> exception from SWT.
>
> The patch also shows bug
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=234103. When you start the
> workbench nothing seems to be selected in DemoTableViewPart, but if you
> scroll up bit, then you see the selection. Pushing the extra button alwas
> reveals the selection.
>
> Regards,
> Markus
>
>
>
>
>
> "Rüdiger Herrmann" <rherrmann@innoopract.com> schrieb im Newsbeitrag
> news:g1knc6$dnn$1@build.eclipse.org...
>> Markus,
>>
>> I couldn't reproduce what you describe. I changed the WorkbenchDemo
>> by adding a UIJob that refreshes a viewer.
>> Could you provide a standalone snippet that reproduces the behavior?
>>
>> Cheers
>> Rüdiger
>>
>>
>> Markus Krüger wrote:
>>> I might need to add, that this only happens in IE (i use IE7), not in
>>> FireFox!?
>>>
>>>
>>> "Markus Krüger" <krueger@ion.ag> schrieb im Newsbeitrag
>>> news:g1eti7$tnt$1@build.eclipse.org...
>>>> Hi,
>>>> I get an invalid thread access exepction from SWT as I call refresh on
>>>> my
>>>> table viewer. I use the following code that is inside a listener that
>>>> listens for changes of my model:
>>>>
>>>> DUMMY.addSaveListener(new ISaveListener(){
>>>> public void saved() {
>>>> Job refreshJob = new UIJob(""){
>>>> public IStatus runInUIThread(IProgressMonitor monitor) {
>>>> monitor.beginTask("Refreshing...", 1);
>>>> refresh();
>>>> monitor.done();
>>>> return Status.OK_STATUS;
>>>> }
>>>>
>>>> };
>>>> refreshJob.setUser(true);
>>>> refreshJob.schedule();
>>>> }
>>>> public void savedApplKindPauschData() {
>>>> }
>>>> });
>>>>
>>>> public void refresh() {
>>>> if(!viewer.getTable().isDisposed())
>>>> viewer.refresh();
>>>> }
>>>>
>>>> Regards,
>>>> Markus
>>>>
>>>
>
>
Previous Topic:Border on Text and other Widgets and Custom Variant
Next Topic:how to put something into <HEAD>
Goto Forum:
  


Current Time: Fri Apr 26 12:20:42 GMT 2024

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

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

Back to the top