Check if view is destroyed before sending ipc message (#2505)
This commit is contained in:
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@@ -13,6 +13,7 @@
|
||||
"chromedriver",
|
||||
"chromedriverlog",
|
||||
"deauthorize",
|
||||
"deeplink",
|
||||
"deeplinking",
|
||||
"diskimage",
|
||||
"dont",
|
||||
|
@@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user