| Summary: | IllegalStateException in ServiceContext when disposing connection bendpoints | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Shenxue Zhou <shenxue.zhou> |
| Component: | Sapphire | Assignee: | Shenxue Zhou <shenxue.zhou> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | konstantin |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
IllegalStateException here means that ServiceContext is being accessed after it was disposed. Model element's service context is disposed when model element is disposed. The problem arises during ModelElementList.refreshValidationResult call on line 203. On that line, it's the parent element's services that are accessed. In this case, it looks like that would be IComponentDependency So... You are are somehow getting into a situation in ArchitectureDiagramLayoutPersistenceService where you trying to interact with an IComponentDependency element that has already been removed from the model and disposed. Let me know if you need further help on this. When connection bendpoints removal event is processed inside the Architeture persistence service, we check disposed status on IComponentDependency first. Verified. Closing. To verify, I have done the following: 1. Starting with a new architecture file, I created two components and a connection between them. 2. Added a few bendpoints to the connection. 3. Saved. 4. Deleted the connection. 5. Saved. 6. Verified no errors in the log or the console. |
It doesn't happen all the time. Here is the stack trace when it happens: java.lang.IllegalStateException at org.eclipse.sapphire.services.ServiceContext.services(ServiceContext.java:78) at org.eclipse.sapphire.modeling.ModelElement.services(ModelElement.java:667) at org.eclipse.sapphire.modeling.ModelElementList.refreshValidationResult(ModelElementList.java:203) at org.eclipse.sapphire.modeling.ModelElementList.refresh(ModelElementList.java:194) at org.eclipse.sapphire.modeling.ModelElementList.remove(ModelElementList.java:350) at org.eclipse.sapphire.modeling.ModelElementList.clear(ModelElementList.java:404) at org.eclipse.sapphire.samples.architecture.internal.ArchitectureDiagramLayoutPersistenceService.write(ArchitectureDiagramLayoutPersistenceService.java:117) at org.eclipse.sapphire.samples.architecture.internal.ArchitectureDiagramLayoutPersistenceService.access$4(ArchitectureDiagramLayoutPersistenceService.java:86) at org.eclipse.sapphire.samples.architecture.internal.ArchitectureDiagramLayoutPersistenceService$1.handleConnectionRemoveBendpointEvent(ArchitectureDiagramLayoutPersistenceService.java:289) at org.eclipse.sapphire.ui.diagram.editor.SapphireDiagramEditorPagePart.notifyConnectionRemoveBendpoint(SapphireDiagramEditorPagePart.java:660) at org.eclipse.sapphire.ui.diagram.editor.SapphireDiagramEditorPagePart.access$9(SapphireDiagramEditorPagePart.java:652) at org.eclipse.sapphire.ui.diagram.editor.SapphireDiagramEditorPagePart$ConnectionTemplateListener.handleRemoveBendpoint(SapphireDiagramEditorPagePart.java:822) at org.eclipse.sapphire.ui.diagram.editor.DiagramConnectionTemplate.notifyRemoveBendpoint(DiagramConnectionTemplate.java:760) at org.eclipse.sapphire.ui.diagram.editor.DiagramConnectionTemplate$ConnectionPartListener.handleConnectionRemoveBendpointEvent(DiagramConnectionTemplate.java:818) at org.eclipse.sapphire.ui.diagram.editor.DiagramConnectionPart.notifyRemoveBendpoint(DiagramConnectionPart.java:630) at org.eclipse.sapphire.ui.diagram.editor.DiagramConnectionPart.removeAllBendpoints(DiagramConnectionPart.java:699) at org.eclipse.sapphire.ui.gef.diagram.editor.model.DiagramModel.removeConnection(DiagramModel.java:215) at org.eclipse.sapphire.ui.gef.diagram.editor.SapphireDiagramEditor.removeConnection(SapphireDiagramEditor.java:268) at org.eclipse.sapphire.ui.gef.diagram.editor.SapphireDiagramEditor$1.handleConnectionDeleteEvent(SapphireDiagramEditor.java:181) at org.eclipse.sapphire.ui.diagram.editor.SapphireDiagramEditorPagePart.notifyConnectionDelete(SapphireDiagramEditorPagePart.java:634) at org.eclipse.sapphire.ui.diagram.editor.SapphireDiagramEditorPagePart.access$7(SapphireDiagramEditorPagePart.java:626) at org.eclipse.sapphire.ui.diagram.editor.SapphireDiagramEditorPagePart$ConnectionTemplateListener.handleConnectionDelete(SapphireDiagramEditorPagePart.java:810) at org.eclipse.sapphire.ui.diagram.editor.DiagramConnectionTemplate.notifyConnectionDelete(DiagramConnectionTemplate.java:744) at org.eclipse.sapphire.ui.diagram.editor.DiagramConnectionTemplate.handleModelPropertyChange(DiagramConnectionTemplate.java:616) at org.eclipse.sapphire.ui.diagram.editor.DiagramEmbeddedConnectionTemplate$1.handlePropertyChangedEvent(DiagramEmbeddedConnectionTemplate.java:77) at org.eclipse.sapphire.modeling.ModelElement.notifyPropertyChangeListeners(ModelElement.java:1194) at org.eclipse.sapphire.modeling.ModelElement.notifyPropertyChangeListeners(ModelElement.java:1151) at org.eclipse.sapphire.modeling.ModelElementList.refresh(ModelElementList.java:191) at org.eclipse.sapphire.modeling.ModelElementList.remove(ModelElementList.java:350) at org.eclipse.sapphire.ui.diagram.actions.DiagramDeleteActionHandler.run(DiagramDeleteActionHandler.java:65) at org.eclipse.sapphire.ui.SapphireActionHandler.execute(SapphireActionHandler.java:93) at org.eclipse.sapphire.ui.diagram.actions.DiagramDeleteActionHandler.deleteConnection(DiagramDeleteActionHandler.java:140) at org.eclipse.sapphire.ui.diagram.actions.DiagramDeleteActionHandler.deleteNodeConnections(DiagramDeleteActionHandler.java:113) at org.eclipse.sapphire.ui.diagram.actions.DiagramDeleteActionHandler.run(DiagramDeleteActionHandler.java:72) at org.eclipse.sapphire.ui.SapphireActionHandler.execute(SapphireActionHandler.java:93) at org.eclipse.sapphire.ui.gef.diagram.editor.DiagramKeyboardActionPresentation$SapphireDiagramKeyHandler$1.run(DiagramKeyboardActionPresentation.java:126) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) 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:622) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577) at org.eclipse.equinox.launcher.Main.run(Main.java:1410) at org.eclipse.equinox.launcher.Main.main(Main.java:1386)