From ab52530c10dec98212c845e035b9219a03796d9f Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Thu, 9 Mar 2023 11:29:33 -0800 Subject: [PATCH] Fix object destroyed error --- app/main.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/main.ts b/app/main.ts index 2cd1773fd2..595a5ef81e 100644 --- a/app/main.ts +++ b/app/main.ts @@ -694,8 +694,13 @@ async function safeLoadURL(window: BrowserWindow, url: string): Promise { } 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. + } } }