diff options
| author | Pierre-Charles David | 2016-09-12 14:36:25 +0000 |
|---|---|---|
| committer | Pierre-Charles David | 2016-10-18 15:24:51 +0000 |
| commit | d7b5834511b4ba3ce259f47daf0bcf2e0a1e304b (patch) | |
| tree | 1c5e5dc967737eadfe4a940594adf6c2ec40510f | |
| parent | d7b9bc29b1f3bfba6c6a05ad7ad7579b372e8428 (diff) | |
| download | org.eclipse.sirius-d7b5834511b4ba3ce259f47daf0bcf2e0a1e304b.tar.gz org.eclipse.sirius-d7b5834511b4ba3ce259f47daf0bcf2e0a1e304b.tar.xz org.eclipse.sirius-d7b5834511b4ba3ce259f47daf0bcf2e0a1e304b.zip | |
[501263] Cleanup DTreeEditor references on disposal
A disposed editor can still be referenced by parts of the Eclipse
runtime (e.g. in ContextService.UpdateExpression via an
ActivePartExpression), so it is important to cleanup all the references
we keep on large structures (models, the session) when disposed to avoid
memory leaks.
Bug: 501263
Change-Id: I7daa829a59d830d0bab4582769957ad21f3f2636
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
3 files changed, 15 insertions, 12 deletions
diff --git a/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/api/editor/AbstractSpecificDTableEditor.java b/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/api/editor/AbstractSpecificDTableEditor.java index f07dd96121..4958b3030d 100644 --- a/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/api/editor/AbstractSpecificDTableEditor.java +++ b/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/api/editor/AbstractSpecificDTableEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2016 THALES GLOBAL SERVICES and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -33,27 +33,21 @@ public abstract class AbstractSpecificDTableEditor extends AbstractDTableEditor private SpecificEditorInputTranformer util = new SpecificEditorInputTranformer(); - /** - * {@inheritDoc} - */ @Override public void dispose() { super.dispose(); - util.cleanEnvironment(); + if (util != null) { + util.cleanEnvironment(); + util = null; + } } - /** - * {@inheritDoc} - */ @Override public void init(final IEditorSite site, final IEditorInput input) throws PartInitException { util.init(getViewpointURI(), getDiagramDescriptionName()); super.init(site, util.transformInput(input, getSelection(site), isSessionStoredInWorkspace())); } - /** - * {@inheritDoc} - */ @Override public void setInput(IEditorInput input) { super.setInput(util.transformInput(input, getSelection(getSite()), isSessionStoredInWorkspace())); diff --git a/plugins/org.eclipse.sirius.tree.ui/src/org/eclipse/sirius/tree/ui/tools/internal/editor/DTreeEditor.java b/plugins/org.eclipse.sirius.tree.ui/src/org/eclipse/sirius/tree/ui/tools/internal/editor/DTreeEditor.java index 54d1c03b8d..82b4dc1412 100644 --- a/plugins/org.eclipse.sirius.tree.ui/src/org/eclipse/sirius/tree/ui/tools/internal/editor/DTreeEditor.java +++ b/plugins/org.eclipse.sirius.tree.ui/src/org/eclipse/sirius/tree/ui/tools/internal/editor/DTreeEditor.java @@ -467,6 +467,7 @@ public class DTreeEditor extends AbstractDTreeEditor implements org.eclipse.siri if (getAdapterFactory() instanceof IDisposable) { ((IDisposable) getAdapterFactory()).dispose(); } + treeModel = null; } /** diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/AbstractDTreeEditor.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/AbstractDTreeEditor.java index 74e30eb207..88d5644465 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/AbstractDTreeEditor.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/AbstractDTreeEditor.java @@ -592,6 +592,7 @@ public abstract class AbstractDTreeEditor extends EditorPart if (dRepresentationLockStatusListener != null) { IPermissionAuthority permissionAuthority = PermissionAuthorityRegistry.getDefault().getPermissionAuthority(getRepresentation()); permissionAuthority.removeAuthorityListener(dRepresentationLockStatusListener); + dRepresentationLockStatusListener = null; } isClosing = true; @@ -601,10 +602,12 @@ public abstract class AbstractDTreeEditor extends EditorPart if (this.undoRedoActionHandler != null) { this.undoRedoActionHandler.dispose(); } + undoRedoActionHandler = null; super.dispose(); if (getTableViewer() != null) { getTableViewer().dispose(); } + treeViewerManager = null; // We need to perform the detachEditor after having disposed the viewer // and the editor input to avoid a refresh. A refresh can occurs in the // case where the detach triggers the reload of the modified resources @@ -615,8 +618,13 @@ public abstract class AbstractDTreeEditor extends EditorPart if (sess != null) { sess.detachEditor(this, choice == ISaveablePart2.NO); } + session = null; } - + adapterFactory = null; + accessor = null; + currentPropertySheetpage = null; + emfCommandFactory = null; + myDialogFactory = null; } @Override |
