diff options
| author | Kalyan Prasad | 2016-03-11 07:18:13 +0000 |
|---|---|---|
| committer | Kalyan Prasad | 2016-03-11 07:18:46 +0000 |
| commit | df1a6b461f7ea228edf320f0a2072a5f5d06cd13 (patch) | |
| tree | d5b3e75d61c6031b76beb1e47ae0e4a31712aa4a | |
| parent | c5ddff0c63ab7fff1aa21973becbab2b81dc50b0 (diff) | |
| download | eclipse.platform.ui-df1a6b461f7ea228edf320f0a2072a5f5d06cd13.tar.gz eclipse.platform.ui-df1a6b461f7ea228edf320f0a2072a5f5d06cd13.tar.xz eclipse.platform.ui-df1a6b461f7ea228edf320f0a2072a5f5d06cd13.zip | |
Bug 486474 - Menu are not correctly filled calling menu service
When removeAllWhenShown is set to true, upon showing the menu, the menu
items are removed from the MenuManager, but not from MMenu. This is
causing this problem as well as memory leak as some menu items get added
multiple times to MMenu. This patch fixes this issue
Change-Id: I88f2f510b8c3738c15e8e1fb3e5ffa3a700fa838
Signed-off-by: Kalyan Prasad <kalyan_prasad@in.ibm.com>
| -rw-r--r-- | bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerShowProcessor.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerShowProcessor.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerShowProcessor.java index 618bbc92690..09e221d00ef 100644 --- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerShowProcessor.java +++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerShowProcessor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 IBM Corporation and others. + * Copyright (c) 2010, 2016 IBM Corporation 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 @@ -79,6 +79,12 @@ public class MenuManagerShowProcessor implements IMenuListener2 { if (menuModel != null && menuManager != null) { cleanUp(menuModel, menuManager); + if (menuManager.getRemoveAllWhenShown()) { + // This needs to be done or else menu items get added multiple + // times to MenuModel which results in incorrect behavior and + // memory leak - bug 486474 + menuModel.getChildren().removeAll(menuModel.getChildren()); + } } if (menuModel instanceof MPopupMenu) { showPopup(menu, (MPopupMenu) menuModel, menuManager); |
