Skip to content

Commit

Permalink
ignore IPC messages from views when the parent window has been destroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
PalmerAL committed Mar 7, 2024
1 parent e27ae40 commit 6327c76
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions main/viewManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ function createView (existingViewId, id, webPreferences, boundsString, events) {

const eventTarget = BrowserWindow.fromBrowserView(view) || windows.getCurrent()

if (!eventTarget) {
//this can happen during shutdown - windows can be destroyed before the corresponding views, and the view can emit an event during that time
return
}

eventTarget.webContents.send('view-ipc', {
id: id,
name: channel,
Expand Down

0 comments on commit 6327c76

Please sign in to comment.