Merge pull request #1176 from johankwarnmarksymphony/SDA-2916

fix: sda-2916 got several listeners to screen-source-select, remove all listeners w…
This commit is contained in:
Johan Kwarnmark 2021-01-25 17:32:55 +01:00 committed by GitHub
commit c6354bf3f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
});