tmf: Workaround for leaking views
authorPatrick Tasse <patrick.tasse@gmail.com>
Wed, 6 Apr 2016 15:08:54 +0000 (11:08 -0400)
committerPatrick Tasse <patrick.tasse@gmail.com>
Mon, 11 Apr 2016 18:32:03 +0000 (14:32 -0400)
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 <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/70059
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/TmfView.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/SDView.java

index feaffa8e6fc3fc83859503860c57b52f8edb5317..555711dcfc34fb04a7f0fff055e025a93a62f342 100644 (file)
@@ -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();
     }
 
index cfb38837473834aa63906b694020d0181d25b56a..71b035c6e862f327995320bf23424db72403df07 100644 (file)
@@ -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();
This page took 0.025458 seconds and 5 git commands to generate.