Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2015-02-20 11:38:48 +0000
committerLaurent Redor2015-02-26 09:56:33 +0000
commit051561733efbb093b4dd606d727041b0170ecbd3 (patch)
treea1ddf6f9527afffa2d676c005184b5cd89494c02
parent1fb9718ebf64ccf3c3054a03062f304e7ffbb3ff (diff)
downloadorg.eclipse.sirius-051561733efbb093b4dd606d727041b0170ecbd3.tar.gz
org.eclipse.sirius-051561733efbb093b4dd606d727041b0170ecbd3.tar.xz
org.eclipse.sirius-051561733efbb093b4dd606d727041b0170ecbd3.zip
[460816] Dispose graphical listeners sooner during close of diagram
Currently, the dispose of "graphical listeners"* are made in the DDiagramEditorImpl.dispose(). But this method is finally called in asyncExec by org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor.close(boolean). This can be problematic because these listeners can be called with inconsistent state during the close. It is possible to dispose these graphical listeners directly in DDiagramEditorImpl.dispose(), before the call to super.close(boolean), to avoid this kind of problem. "Graphical listeners": All the listeners that update the diagram accordingly to notifications Bug: 460816 Cherry-picked-from: 460432 Change-Id: Ib89780d37810ff888be8a7f3d9212a4bded65bf9 Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/DDiagramEditorImpl.java26
1 files changed, 18 insertions, 8 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/DDiagramEditorImpl.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/DDiagramEditorImpl.java
index 165e1e1aec..7a683d8c37 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/DDiagramEditorImpl.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/DDiagramEditorImpl.java
@@ -328,6 +328,7 @@ public class DDiagramEditorImpl extends SiriusDiagramEditor implements DDiagramE
DiagramPlugin.getDefault().getLog().log(new Status(IStatus.INFO, DiagramPlugin.ID, "Refresh job got interrupted", e));
}
}
+ disposeGraphicalListeners();
super.close(save);
}
@@ -651,18 +652,12 @@ public class DDiagramEditorImpl extends SiriusDiagramEditor implements DDiagramE
@Override
public void dispose() {
isClosing = true;
- // Dispose the tabbar (to avoir memory leak)
+ // Dispose the tabbar (to avoid memory leak)
if (getTabbar() != null) {
getTabbar().dispose();
setTabbar(null);
}
- // Dispose post-commit listener
- disposePostCommitListener();
-
- if (gmfDiagramUpdater != null) {
- gmfDiagramUpdater.dispose();
- gmfDiagramUpdater = null;
- }
+ disposeGraphicalListeners();
if (getDiagram() != null && getDiagram().eResource() != null) {
if (dRepresentationLockStatusListener != null) {
IPermissionAuthority permissionAuthority = PermissionAuthorityRegistry.getDefault().getPermissionAuthority(getDiagram().getElement());
@@ -735,6 +730,21 @@ public class DDiagramEditorImpl extends SiriusDiagramEditor implements DDiagramE
stopDiagramEventBrokerListener(getEditingDomain());
}
+ /**
+ * Dispose all graphical listeners. This method can be called as soon as the
+ * close of the editor is in progress. This avoids that these listeners
+ * react to notification whereas the editor will be closed.
+ */
+ protected void disposeGraphicalListeners() {
+ // Dispose post-commit listener
+ disposePostCommitListener();
+
+ if (gmfDiagramUpdater != null) {
+ gmfDiagramUpdater.dispose();
+ gmfDiagramUpdater = null;
+ }
+ }
+
private void disposeOutline() {
if (diagramOutline != null) {
this.diagramOutline = null;

Back to the top