diff --git a/src/desktop/main.ts b/src/desktop/main.ts index a19b0a44b9..c856ba8699 100644 --- a/src/desktop/main.ts +++ b/src/desktop/main.ts @@ -286,8 +286,11 @@ async function showSplashScreen() { function closeSplashScreen() { if (splashWindow) { console.log(`[${timestamp()}] Closing splash screen...`); - splashWindow.close(); + const win = splashWindow; splashWindow = null; + if (!win.isDestroyed()) { + win.destroy(); // Immediate destruction - avoids race with internal renderer scripts + } } } diff --git a/src/node/services/tools/notify.ts b/src/node/services/tools/notify.ts index 960955ebf3..0d85d89c83 100644 --- a/src/node/services/tools/notify.ts +++ b/src/node/services/tools/notify.ts @@ -76,7 +76,7 @@ async function sendElectronNotification( notification.on("click", () => { const windows = BrowserWindow.getAllWindows(); const mainWindow = windows[0]; - if (mainWindow) { + if (mainWindow && !mainWindow.isDestroyed()) { // Restore if minimized, then focus if (mainWindow.isMinimized()) { mainWindow.restore();