Skip to content

Commit 1f31957

Browse files
author
Benjamin Pasero
committed
contextmenu - do not send functions over ipc (fix microsoft#100982)
1 parent 37ca38a commit 1f31957

3 files changed

Lines changed: 5 additions & 7 deletions

File tree

src/vs/base/parts/contextmenu/common/contextmenu.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ export interface IPopupOptions {
3636
x?: number;
3737
y?: number;
3838
positioningItem?: number;
39-
onHide?: () => void;
4039
}
4140

4241
export const CONTEXT_MENU_CHANNEL = 'vscode:contextmenu';
43-
export const CONTEXT_MENU_CLOSE_CHANNEL = 'vscode:onCloseContextMenu';
42+
export const CONTEXT_MENU_CLOSE_CHANNEL = 'vscode:onCloseContextMenu';

src/vs/base/parts/contextmenu/electron-sandbox/contextmenu.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { IContextMenuItem, ISerializableContextMenuItem, CONTEXT_MENU_CLOSE_CHAN
88

99
let contextMenuIdPool = 0;
1010

11-
export function popup(items: IContextMenuItem[], options?: IPopupOptions): void {
11+
export function popup(items: IContextMenuItem[], options?: IPopupOptions, onHide?: () => void): void {
1212
const processedItems: IContextMenuItem[] = [];
1313

1414
const contextMenuId = contextMenuIdPool++;
@@ -28,8 +28,8 @@ export function popup(items: IContextMenuItem[], options?: IPopupOptions): void
2828

2929
ipcRenderer.removeListener(onClickChannel, onClickChannelHandler);
3030

31-
if (options?.onHide) {
32-
options.onHide();
31+
if (onHide) {
32+
onHide();
3333
}
3434
});
3535

src/vs/workbench/services/contextmenu/electron-sandbox/contextmenuService.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ class NativeContextMenuService extends Disposable implements IContextMenuService
118118
x: Math.floor(x),
119119
y: Math.floor(y),
120120
positioningItem: delegate.autoSelectFirstItem ? 0 : undefined,
121-
onHide: () => onHide()
122-
});
121+
}, () => onHide());
123122
}
124123
}
125124

0 commit comments

Comments
 (0)