Check if view is destroyed before sending ipc message (#2505)

This commit is contained in:
Tasos Boulis
2023-01-18 19:24:42 +02:00
committed by GitHub
parent c8c88a274f
commit 5bafaff297
2 changed files with 6 additions and 1 deletions

View File

@@ -13,6 +13,7 @@
"chromedriver", "chromedriver",
"chromedriverlog", "chromedriverlog",
"deauthorize", "deauthorize",
"deeplink",
"deeplinking", "deeplinking",
"diskimage", "diskimage",
"dont", "dont",

View File

@@ -549,6 +549,10 @@ export class ViewManager {
}; };
sendToAllViews = (channel: string, ...args: unknown[]) => { sendToAllViews = (channel: string, ...args: unknown[]) => {
this.views.forEach((view) => view.view.webContents.send(channel, ...args)); this.views.forEach((view) => {
if (!view.view.webContents.isDestroyed()) {
view.view.webContents.send(channel, ...args);
}
});
} }
} }