Bug 279802 - [Core] Exception loop after the last diagram gets closed
Summary: [Core] Exception loop after the last diagram gets closed
Status: RESOLVED FIXED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Core (show other bugs)
Version: 0.7.0   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: M1   Edit
Assignee: Cedric Dumoulin CLA
QA Contact:
URL:
Whiteboard:
Keywords: plan
Depends on: 279226
Blocks:
  Show dependency tree
 
Reported: 2009-06-10 10:10 EDT by Yann Tanguy CLA
Modified: 2009-10-15 10:56 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yann Tanguy CLA 2009-06-10 10:10:18 EDT
To reproduce:

- create a model with several diagrams
- close all diagrams
- click alternatively in navigator and editor --> this generates exceptions

java.lang.NullPointerException
	at org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor.getDiagramDocument(DiagramDocumentEditor.java:232)
	at org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditor.getNavigatorSelection(UMLDiagramEditor.java:275)
	at org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditor.getShowInContext(UMLDiagramEditor.java:268)
	at org.eclipse.ui.internal.services.WorkbenchSourceProvider.getContext(WorkbenchSourceProvider.java:422)
	at org.eclipse.ui.internal.services.WorkbenchSourceProvider.updateActivePart(WorkbenchSourceProvider.java:488)
	at org.eclipse.ui.internal.services.WorkbenchSourceProvider.checkActivePart(WorkbenchSourceProvider.java:306)
	at org.eclipse.ui.internal.services.WorkbenchSourceProvider.checkActivePart(WorkbenchSourceProvider.java:301)
	at org.eclipse.ui.internal.services.WorkbenchSourceProvider$1.partBroughtToTop(WorkbenchSourceProvider.java:240)
	at org.eclipse.ui.internal.PartListenerList$2.run(PartListenerList.java:87)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.runtime.Platform.run(Platform.java:888)
	at org.eclipse.ui.internal.PartListenerList.fireEvent(PartListenerList.java:57)
	at org.eclipse.ui.internal.PartListenerList.firePartBroughtToTop(PartListenerList.java:85)
	at org.eclipse.ui.internal.PartService.firePartBroughtToTop(PartService.java:208)
	at org.eclipse.ui.internal.WWinPartService$WWinListener.partBroughtToTop(WWinPartService.java:42)
	at org.eclipse.ui.internal.PartListenerList2$2.run(PartListenerList2.java:85)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.runtime.Platform.run(Platform.java:888)
	at org.eclipse.ui.internal.PartListenerList2.fireEvent(PartListenerList2.java:55)
	at org.eclipse.ui.internal.PartListenerList2.firePartBroughtToTop(PartListenerList2.java:83)
	at org.eclipse.ui.internal.PartService.firePartBroughtToTop(PartService.java:212)
	at org.eclipse.ui.internal.WorkbenchPagePartList.firePartBroughtToTop(WorkbenchPagePartList.java:76)
	at org.eclipse.ui.internal.WorkbenchPage.bringToTop(WorkbenchPage.java:858)
	at org.eclipse.ui.internal.views.log.LogView$25.run(LogView.java:1067)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3855)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3476)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
	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:368)
	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:559)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
Comment 1 Cedric Dumoulin CLA 2009-06-12 12:10:46 EDT
This bug come from several problems:
1) The getDiagramDocument(DiagramDocumentEditor.java:232) method doesn't check for null when doing getDocumentProvider().
2) The document provider is null because the editor has been disposed (which is normal).
3) An event  handler still call the getDiagramDocument() method while the editor is disposed. This is done by an Eclipse service which still have a reference on the editor.

Actions:
1) We should remove the reference from the Eclipse service. Maybe calling the org.eclipse.papyrus.sasheditor.internal.ActiveEditorServicesSwitcher.activeEditorChanged(PagePart, PagePart)  do the trick.
This should be done by a call to org.eclipse.papyrus.sasheditor.internal.SashWindowsContainer.pageChanged(PagePart) after the call to refreshTabs(). This is linked to the fact the pageChanged() is not actually properly called.

2)  getDiagramDocument() method should check for null value.
Comment 2 Cedric Dumoulin CLA 2009-06-26 17:37:34 EDT
Calling pageChanged() properly clean up the faulty handler and solves the bug.