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', () => {
|
ipcMain.on('closeSecondaryWindows', () => {
|
||||||
var windows = BrowserWindow.getAllWindows();
|
const windows = BrowserWindow.getAllWindows();
|
||||||
for (var i = 0; i < windows.length; i++) {
|
for (let i = 0; i < windows.length; i++) {
|
||||||
if (!mainWindow || windows[i].id != mainWindow.id) {
|
const win = windows[i];
|
||||||
windows[i].close();
|
if (!win.isDestroyed() && (!mainWindow || win.id != mainWindow.id)) {
|
||||||
|
win.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -94,7 +94,16 @@ export class InAppBrowserObjectMock {
|
||||||
* Close the window.
|
* Close the window.
|
||||||
*/
|
*/
|
||||||
close(): void {
|
close(): void {
|
||||||
this.window.close();
|
if (this.window.isDestroyed()) {
|
||||||
|
// Window already closed, nothing to do.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.window.close();
|
||||||
|
} catch (ex) {
|
||||||
|
// Ignore errors.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue