Skip to content

Commit b4701ab

Browse files
author
Akos Kitta
committed
fix: undisposed submenu on menu rebuild
Signed-off-by: Akos Kitta <[email protected]>
1 parent 7fb677c commit b4701ab

File tree

1 file changed

+6
-0
lines changed
  • arduino-ide-extension/src/browser/contributions

1 file changed

+6
-0
lines changed

arduino-ide-extension/src/browser/contributions/examples.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
CoreService,
3030
} from '../../common/protocol';
3131
import { nls } from '@theia/core/lib/common';
32+
import { unregisterSubmenu } from '../menu/arduino-menus';
3233

3334
@injectable()
3435
export abstract class Examples extends SketchContribution {
@@ -120,6 +121,11 @@ export abstract class Examples extends SketchContribution {
120121
const { label } = sketchContainerOrPlaceholder;
121122
submenuPath = [...menuPath, label];
122123
this.menuRegistry.registerSubmenu(submenuPath, label, subMenuOptions);
124+
this.toDispose.push(
125+
Disposable.create(() =>
126+
unregisterSubmenu(submenuPath, this.menuRegistry)
127+
)
128+
);
123129
sketches.push(...sketchContainerOrPlaceholder.sketches);
124130
children.push(...sketchContainerOrPlaceholder.children);
125131
} else {

0 commit comments

Comments
 (0)