From 451fd9201c13c87b4e91aa2cdee66b9dcbf68697 Mon Sep 17 00:00:00 2001 From: Johan Kwarnmark Date: Mon, 25 Jan 2021 14:31:22 +0100 Subject: [PATCH] got several listeners to screen-source-select, remove all listeners when pickers closes --- src/app/window-handler.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/app/window-handler.ts b/src/app/window-handler.ts index 66b46c98..887e3898 100644 --- a/src/app/window-handler.ts +++ b/src/app/window-handler.ts @@ -1218,7 +1218,7 @@ export class WindowHandler { this.addWindow(opts.winKey, this.screenPickerWindow); }); - ipcMain.on('screen-source-select', (_event, source) => { + const screenSourceSelect = (_event, source) => { if (source != null) { logger.info(`window-handler: screen-source-select`, source, id); @@ -1229,12 +1229,15 @@ export class WindowHandler { timeoutValue, ); } - }); + }; + + ipcMain.on('screen-source-select', screenSourceSelect); ipcMain.once('screen-source-selected', (_event, source) => { logger.info(`window-handler: screen-source-selected`, source, id); - - this.drawScreenShareIndicatorFrame(source); + if (source == null) { + this.execCmd(this.screenShareIndicatorFrameUtil, []); + } window.send('start-share' + id, source); if (this.screenPickerWindow && windowExists(this.screenPickerWindow)) { @@ -1242,7 +1245,7 @@ export class WindowHandler { } }); this.screenPickerWindow.once('closed', () => { - this.execCmd(this.screenShareIndicatorFrameUtil, []); + ipcMain.removeListener('screen-source-select', screenSourceSelect); this.removeWindow(opts.winKey); this.screenPickerWindow = null; });