Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2015-02-20 11:38:48 +0000
committerLaurent Redor2015-02-20 11:38:48 +0000
commited7aa3572746fd6c1c7238415e10dc0ccd3ee204 (patch)
treec5629332780c62be41feedb755ddf9121065245a
parent55ba702276e599b0df1db41d9547405ae5fcf482 (diff)
downloadorg.eclipse.sirius-ed7aa3572746fd6c1c7238415e10dc0ccd3ee204.tar.gz
org.eclipse.sirius-ed7aa3572746fd6c1c7238415e10dc0ccd3ee204.tar.xz
org.eclipse.sirius-ed7aa3572746fd6c1c7238415e10dc0ccd3ee204.zip
[460432] 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: 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.java34
1 files changed, 22 insertions, 12 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 57e0b52d9a..5cc883dc12 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
@@ -329,6 +329,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);
}
@@ -652,18 +653,7 @@ public class DDiagramEditorImpl extends SiriusDiagramEditor implements DDiagramE
@Override
public void dispose() {
isClosing = true;
- // Dispose the tabbar (to avoir 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());
@@ -736,6 +726,26 @@ 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 the tabbar (to avoir memory leak)
+ if (getTabbar() != null) {
+ getTabbar().dispose();
+ setTabbar(null);
+ }
+ // 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