Skip to content

fix: crash when webContents is detached before 'destroyed' event#196

Merged
sindresorhus merged 2 commits intosindresorhus:mainfrom
ECRomaneli:fix-remove-listener-from-undef
Mar 19, 2026
Merged

fix: crash when webContents is detached before 'destroyed' event#196
sindresorhus merged 2 commits intosindresorhus:mainfrom
ECRomaneli:fix-remove-listener-from-undef

Conversation

@ECRomaneli
Copy link
Copy Markdown
Contributor

Handle Electron 41 breaking change where WebContentsView.webContents becomes undefined right before the webContents is destroyed.
electron/electron#50249

Handle the Electron 41 breaking change where WebContentsView.webContents becomes undefined after the underlying webContents is destroyed. electron/electron#50249
@ECRomaneli
Copy link
Copy Markdown
Contributor Author

I have added a second commit to ensure we removed the event from the webContents we added it to. ElectronJS never made it clear if the events are safely unbound after destruction, so it could hold a reference and creates a small leak.

@sindresorhus sindresorhus merged commit 7a80171 into sindresorhus:main Mar 19, 2026
0 of 2 checks passed
@ECRomaneli ECRomaneli deleted the fix-remove-listener-from-undef branch March 27, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants