Skip to main content



      Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » EMF Forms Widget Disposed Exception(I get Widget Disposed Exception when using a ECPSWTViewRenderer.INSTANCE.render(...);)
EMF Forms Widget Disposed Exception [message #1782227] Tue, 20 February 2018 13:44 Go to next message
Eclipse UserFriend
I am using EMFForms to get a composite populated with the details of an EObject selected in another widget, The basic sequence is the following:

1. In widgetA, an EObject (EObject1) is selected.
2. Widget widgetB, which contains the EMFForm generate details, receives the selection.
3. The controls in widgetB are disposed.
4. A VView (viewModel) is created for eObject1;
5. ECPSWTViewRenderer.INSTANCE.render(widgetB, eObject1, viewModel) is called.
6. Up to that point, all is good.
7. A new eObject (eObject2) is selected in widgetA.
8. Steps 2 to 5 are repeated for eObject2.
9 . At that point, an attribute changes in eObject1 (which no longer displayed) starte chnaging periodically (it is driven from a Job) . I then start to continuously get :

org.eclipse.swt.SWTException: Failed to execute runnable (org.eclipse.swt.SWTException: Widget is disposed)
at org.eclipse.swt.SWT.error(SWT.java:4533)
at org.eclipse.swt.SWT.error(SWT.java:4448)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4536)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4154)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:693)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at ca.gc.asc_csa.apogy.rcp.Application.start(Application.java:20)
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:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
Caused by: org.eclipse.swt.SWTException: Widget is disposed
at org.eclipse.swt.SWT.error(SWT.java:4533)
at org.eclipse.swt.SWT.error(SWT.java:4448)
at org.eclipse.swt.SWT.error(SWT.java:4419)
at org.eclipse.swt.widgets.Widget.error(Widget.java:483)
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:420)
at org.eclipse.swt.widgets.Composite.layout(Composite.java:962)
at org.eclipse.emf.ecp.view.internal.core.swt.renderer.LinkControlSWTRenderer$9$1.run(LinkControlSWTRenderer.java:420)
at org.eclipse.ui.internal.UILockListener.doPendingWork(UILockListener.java:162)
at org.eclipse.ui.internal.UISynchronizer$3.run(UISynchronizer.java:154)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
... 24 more

I believe the problem is the dispose done in step 3. It seems that the listeners that are created by EMFForms are not unregistered and keep trying to update the widgets.

What is the correct way of disposing of an EMFForm generated composite content to prevent this from happening ?

Thanks !
Re: EMF Forms Widget Disposed Exception [message #1782447 is a reply to message #1782227] Fri, 23 February 2018 09:49 Go to previous message
Eclipse UserFriend
Hi,

you need to dispose the ECPSWTView, which is returned from the render call, i.e.
ecpSWTView.dispose();
Please note that if the detail pane shows objects of the same type, you can also just replace the input instead of re-rendering everything (see https://eclipsesource.com/blogs/2017/02/06/emf-forms-1-11-0-feature-view-cache-for-tree-master-detail/)

Best regards,

Jonas

-----
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Previous Topic:Generated *FactoryImpl is not an instance of Resource.Factory
Next Topic:Model as a Backend?
Goto Forum:
  


Current Time: Fri Jun 20 13:45:57 EDT 2025

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

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

Back to the top