diff options
author | Johannes Rieken <johannes.rieken@gmail.com> | 2018-11-09 21:20:28 +0300 |
---|---|---|
committer | SteVen Batten <6561887+sbatten@users.noreply.github.com> | 2018-11-09 21:20:28 +0300 |
commit | 5f24c93878bd4bc645a4a17c620e2487b11005f9 (patch) | |
tree | 45a3b4830d708e6957d634a431fe10e0c8174b09 | |
parent | 5e481940ccf7ed9005dfd810f586c09a49421355 (diff) |
dispose submenu after use (#62848)1.29.0
* dispose submenu after use
* dispose in the native case as well
-rw-r--r-- | src/vs/workbench/browser/parts/titlebar/menubarControl.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts index b7ca7da0ba4..3d3ee9cd1b8 100644 --- a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts +++ b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts @@ -745,6 +745,7 @@ export class MenubarControl extends Disposable { const submenuActions: SubmenuAction[] = []; updateActions(submenu, submenuActions); target.push(new SubmenuAction(action.label, submenuActions)); + submenu.dispose(); } else { action.label = this.calculateActionLabel(action); target.push(action); @@ -998,7 +999,8 @@ export class MenubarControl extends Disposable { if (menuItem instanceof SubmenuItemAction) { const submenu = { items: [] }; - this.populateMenuItems(this.menuService.createMenu(menuItem.item.submenu, this.contextKeyService), submenu, keybindings); + const menuToDispose = this.menuService.createMenu(menuItem.item.submenu, this.contextKeyService); + this.populateMenuItems(menuToDispose, submenu, keybindings); let menubarSubmenuItem: IMenubarMenuItemSubmenu = { id: menuItem.id, @@ -1007,6 +1009,7 @@ export class MenubarControl extends Disposable { }; menuToPopulate.items.push(menubarSubmenuItem); + menuToDispose.dispose(); } else { let menubarMenuItem: IMenubarMenuItemAction = { id: menuItem.id, |