Fix object destroyed error

This commit is contained in:
Fedor Indutny 2023-03-09 11:29:33 -08:00 committed by GitHub
parent 8cb281c74e
commit ab52530c10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -694,8 +694,13 @@ async function safeLoadURL(window: BrowserWindow, url: string): Promise<void> {
}
throw error;
} finally {
window.webContents.removeListener('did-stop-loading', onDestroyed);
window.webContents.removeListener('destroyed', onDestroyed);
try {
window.webContents.removeListener('did-stop-loading', onDestroyed);
window.webContents.removeListener('destroyed', onDestroyed);
} catch {
// We already logged or thrown an error - don't bother with handling the
// error here.
}
}
}