MOBILE-2478 desktop: Prevent errors when calling close in closed windows
parent
4b45b3120b
commit
efb5db4f47
|
@ -184,10 +184,11 @@ ipcMain.on('openItem', (event, path) => {
|
|||
});
|
||||
|
||||
ipcMain.on('closeSecondaryWindows', () => {
|
||||
var windows = BrowserWindow.getAllWindows();
|
||||
for (var i = 0; i < windows.length; i++) {
|
||||
if (!mainWindow || windows[i].id != mainWindow.id) {
|
||||
windows[i].close();
|
||||
const windows = BrowserWindow.getAllWindows();
|
||||
for (let i = 0; i < windows.length; i++) {
|
||||
const win = windows[i];
|
||||
if (!win.isDestroyed() && (!mainWindow || win.id != mainWindow.id)) {
|
||||
win.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -94,7 +94,16 @@ export class InAppBrowserObjectMock {
|
|||
* Close the window.
|
||||
*/
|
||||
close(): void {
|
||||
if (this.window.isDestroyed()) {
|
||||
// Window already closed, nothing to do.
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this.window.close();
|
||||
} catch (ex) {
|
||||
// Ignore errors.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue