Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Exception during dispose in GlazedListsEventLayer
Exception during dispose in GlazedListsEventLayer [message #1446425] Thu, 16 October 2014 20:54 Go to next message
Timm Baumeister is currently offline Timm BaumeisterFriend
Messages: 14
Registered: July 2012
Junior Member
After upgrading to 1.1.1, I get an exception when my rcp application (e4.4 with compatibility layer) is trying to shut down:

org.eclipse.swt.SWTException: Failed to execute runnable (org.eclipse.swt.SWTException: Widget is disposed)
	at org.eclipse.swt.SWT.error(SWT.java:4441)
	at org.eclipse.swt.SWT.error(SWT.java:4356)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:139)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4147)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3764)
	at org.eclipse.swt.widgets.Display.release(Display.java:3817)
	at org.eclipse.swt.graphics.Device.dispose(Device.java:295)
	at org.ecabia.das.Application.start(Application.java:27)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Caused by: org.eclipse.swt.SWTException: Widget is disposed
	at org.eclipse.swt.SWT.error(SWT.java:4441)
	at org.eclipse.swt.SWT.error(SWT.java:4356)
	at org.eclipse.swt.SWT.error(SWT.java:4327)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:476)
	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:348)
	at org.eclipse.swt.widgets.ScrollBar.getEnabled(ScrollBar.java:237)
	at org.eclipse.nebula.widgets.nattable.viewport.ScrollBarScroller.getEnabled(ScrollBarScroller.java:96)
	at org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer.recalculateVerticalScrollBar(ViewportLayer.java:1000)
	at org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer.setMinimumOriginY(ViewportLayer.java:276)
	at org.eclipse.nebula.widgets.nattable.viewport.event.ViewportEventHandler.handleLayerEvent(ViewportEventHandler.java:166)
	at org.eclipse.nebula.widgets.nattable.viewport.event.ViewportEventHandler.handleLayerEvent(ViewportEventHandler.java:1)
	at org.eclipse.nebula.widgets.nattable.layer.AbstractLayer.handleLayerEvent(AbstractLayer.java:228)
	at org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer.handleLayerEvent(ViewportLayer.java:1189)
	at org.eclipse.nebula.widgets.nattable.layer.AbstractLayer.fireLayerEvent(AbstractLayer.java:261)
	at org.eclipse.nebula.widgets.nattable.layer.AbstractLayer.handleLayerEvent(AbstractLayer.java:234)
	at org.eclipse.nebula.widgets.nattable.layer.AbstractLayer.fireLayerEvent(AbstractLayer.java:261)
	at org.eclipse.nebula.widgets.nattable.layer.AbstractLayer.handleLayerEvent(AbstractLayer.java:234)
	at org.eclipse.nebula.widgets.nattable.hideshow.AbstractColumnHideShowLayer.handleLayerEvent(AbstractColumnHideShowLayer.java:50)
	at org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer.handleLayerEvent(ColumnHideShowLayer.java:64)
	at org.eclipse.nebula.widgets.nattable.layer.AbstractLayer.fireLayerEvent(AbstractLayer.java:261)
	at org.eclipse.nebula.widgets.nattable.layer.AbstractLayer.handleLayerEvent(AbstractLayer.java:234)
	at org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer.handleLayerEvent(ColumnReorderLayer.java:95)
	at org.eclipse.nebula.widgets.nattable.layer.AbstractLayer.fireLayerEvent(AbstractLayer.java:261)
	at org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer$2.run(GlazedListsEventLayer.java:131)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
	... 18 more


GlazedListsEventLayer apparently tries to access an already disposed widget. Any ideas what has changed since 1.0.0 that may be causing this?
Re: Exception during dispose in GlazedListsEventLayer [message #1446813 is a reply to message #1446425] Fri, 17 October 2014 10:54 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2803
Registered: July 2012
Senior Member
Since 1.0.0? Well a lot has changed since then. If you check the stack trace you see that the update of the scrollbar seems to be the issue. The GlazedListsEventLayer fires a refresh, but on refreshing the NatTable respectively the scrollbars are disposed.

Please file a bug so we can investigate where we need to add a check.
Re: Exception during dispose in GlazedListsEventLayer [message #1446849 is a reply to message #1446813] Fri, 17 October 2014 11:53 Go to previous messageGo to next message
Frank Mosebach is currently offline Frank MosebachFriend
Messages: 7
Registered: September 2014
Junior Member
Hello,

we experienced a similar problem with a custom table layer implementation, where we schedule a task for firing a layer event to be executed on the Display thread, quite similar to what the GlazedListsEventLayer does (in line 128).

The problem is IMO that at the time when the scheduled task will actually be executed, the table may have already been disposed. As a consequence, when the table's ViewportLayer tries to handle the emitted event, it'll fail when trying to adjust the related scrollbars. Actually, the ViewportLayer knows that the table has been disposed at that time, it just doesn't consider that when handling the next layer event.

To fix the described problem, we replaced the standard ViewportLayer implementation with a subclass that overrides the "dispose" and "handleLayerEvent" as follows:

public final class SafeViewportLayer extends ViewportLayer {

  private final AtomicBoolean disposed;

  public SafeViewportLayer(final IUniqueIndexLayer underlyingLayer) {
    super(underlyingLayer);

    this.disposed = new AtomicBoolean();
  }

  @Override
  public void dispose() {
    if (disposed.compareAndSet(false, true)) {
      super.dispose();
    }
  }

  @Override
  public void handleLayerEvent(final ILayerEvent event) {
    if (!disposed.get()) {
      super.handleLayerEvent(event);
    }
  }

}


Regards,
Frank
Re: Exception during dispose in GlazedListsEventLayer [message #1446852 is a reply to message #1446849] Fri, 17 October 2014 11:59 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2803
Registered: July 2012
Senior Member
Two questions:

1. Why do you use a AtomicBoolean and not a simple boolean?
2. Why don't you modify the ViewportLayer and contribute a fix to NatTable Core itself? At least in the long term this would be more efficient. Smile
Re: Exception during dispose in GlazedListsEventLayer [message #1446859 is a reply to message #1446852] Fri, 17 October 2014 12:06 Go to previous messageGo to next message
Frank Mosebach is currently offline Frank MosebachFriend
Messages: 7
Registered: September 2014
Junior Member
Hi Dirk,

(1) You're right, that's not strictly necessary as the layer should only ever be accessed from the Display thread. Hence there shouldn't be any visibility concerns. Just saves me a line in the "if" statement...
(2) I'll do that. I assume that I'll need to submit a bug ticket, including my fix, right?

Regards,
Frank
Re: Exception during dispose in GlazedListsEventLayer [message #1446873 is a reply to message #1446859] Fri, 17 October 2014 12:39 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2803
Registered: July 2012
Senior Member
You need to create a ticket and contribute via Gerrit. I do not accept patches attached to the ticket anymore. Contributing via Gerrit is much easier than dealing with patch files since you simply push your changes to the Gerrit repository where I can review it. And if everything is ok the merge into the NatTable repository is just one click.

https://www.eclipse.org/nattable/documentation.php?page=contribution_guide
Re: Exception during dispose in GlazedListsEventLayer [message #1446940 is a reply to message #1446873] Fri, 17 October 2014 14:37 Go to previous messageGo to next message
Frank Mosebach is currently offline Frank MosebachFriend
Messages: 7
Registered: September 2014
Junior Member
I've tried to clone the repository as described in the contribution guide:

git clone ssh://git.eclipse.org/gitroot/nattable/org.eclipse.nebula.widgets.nattable.git


On the first attempt I was asked for a password, the second attempt failed with an error message:

$ git clone ssh://git.eclipse.org/gitroot/nattable/org.eclipse.nebula.widgets.nattable.git ./trunk
Cloning into './trunk'...
ssh: connect to host git.eclipse.org port 22: Bad file number
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.


What am I doing wrong?

Thanks,
Frank
Re: Exception during dispose in GlazedListsEventLayer [message #1446950 is a reply to message #1446940] Fri, 17 October 2014 14:51 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2803
Registered: July 2012
Senior Member
is ssh working at your place? I had that recently when the ssh access didn't work. In such cases try to use git or http

http://git.eclipse.org/c/nattable/org.eclipse.nebula.widgets.nattable.git/
Re: Exception during dispose in GlazedListsEventLayer [message #1446957 is a reply to message #1446950] Fri, 17 October 2014 15:06 Go to previous messageGo to next message
Frank Mosebach is currently offline Frank MosebachFriend
Messages: 7
Registered: September 2014
Junior Member
Yup,

git clone http://git.eclipse.org/gitroot/nattable/org.eclipse.nebula.widgets.nattable.git


worked perfectly.

Thanks,
Frank
Re: Exception during dispose in GlazedListsEventLayer [message #1450398 is a reply to message #1446957] Wed, 22 October 2014 12:03 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2803
Registered: July 2012
Senior Member
https://bugs.eclipse.org/bugs/show_bug.cgi?id=447942

Thanks for the contribution. The fix will be released with 1.2.0 and should be already available in the latest SNAPSHOT build.
Previous Topic:Cell Image Painter taking too long
Next Topic:How to become a NatTable Committer
Goto Forum:
  


Current Time: Fri Feb 26 04:53:25 GMT 2021

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

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

Back to the top