From: Patrick Tasse Date: Wed, 6 Apr 2016 15:08:54 +0000 (-0400) Subject: tmf: Workaround for leaking views X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=1cefda97f191ee991f26dc1e6cc6be20dcbd8e76;p=deliverable%2Ftracecompass.git tmf: Workaround for leaking views As a workaround for Bug 490400, clear the actions bars of views that contribute to the tool bar manager so that their actions don't retain references to the view when it is closed. Change-Id: I3af262aad4416e40edf587f1313c8480517541b0 Signed-off-by: Patrick Tasse Reviewed-on: https://git.eclipse.org/r/70059 Reviewed-by: Hudson CI Reviewed-by: Matthew Khouzam Tested-by: Matthew Khouzam --- diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/TmfView.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/TmfView.java index feaffa8e6f..555711dcfc 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/TmfView.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/TmfView.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 Ericsson + * Copyright (c) 2009, 2016 Ericsson * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v1.0 which @@ -24,6 +24,7 @@ import org.eclipse.tracecompass.internal.tmf.ui.views.TmfAlignmentSynchronizer; import org.eclipse.tracecompass.tmf.core.component.ITmfComponent; import org.eclipse.tracecompass.tmf.core.signal.TmfSignal; import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager; +import org.eclipse.ui.IActionBars; import org.eclipse.ui.IPartListener; import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.IWorkbenchPart; @@ -73,6 +74,12 @@ public abstract class TmfView extends ViewPart implements ITmfComponent { @Override public void dispose() { TmfSignalManager.deregister(this); + + /* Workaround for Bug 490400: Clear the action bars */ + IActionBars bars = getViewSite().getActionBars(); + bars.getToolBarManager().removeAll(); + bars.getMenuManager().removeAll(); + super.dispose(); } diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/SDView.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/SDView.java index cfb3883747..71b035c6e8 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/SDView.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/SDView.java @@ -268,6 +268,12 @@ public class SDView extends ViewPart implements IPartListener { @Override public void dispose() { KeyBindingsManager.getInstance().remove(this.getSite().getId()); + + /* Workaround for Bug 490400: Clear the action bars */ + IActionBars bars = getViewSite().getActionBars(); + bars.getToolBarManager().removeAll(); + bars.getMenuManager().removeAll(); + disposeZoomActions(); fPrintActionHandler.dispose(); super.dispose();