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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

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

View file

@ -549,6 +549,10 @@ export class ViewManager {
};
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);
}
});
}
}