Skip to content

fix: crash on first "Install & Restart" click after an update#1012

Merged
gabrielste1n merged 2 commits into
OpenWhispr:mainfrom
IdrisGit:fix-auto-update-install-failing
Jul 3, 2026
Merged

fix: crash on first "Install & Restart" click after an update#1012
gabrielste1n merged 2 commits into
OpenWhispr:mainfrom
IdrisGit:fix-auto-update-install-failing

Conversation

@IdrisGit

Copy link
Copy Markdown
Contributor

installUpdate() called app.emit("before-quit") with no Event argument, causing event.preventDefault() to throw TypeError in the app.on("before-quit") listener.

Instead of doing manual teardown and relying on the removeAllListeners workaround, it's now using Electron's dedicated before-quit-for-update event for pre-quit cleanup, and make the before-quit listener update-aware so quitAndInstall() can proceed without preventDefault() blocking it.

Here are the compressed trace logs of the error

> ./OpenWhispr-1.7.2-linux-x86_64.AppImage --log-level=debug 2>&1 | tee ~/openwhispr-session.log
◇ injected env (0) from ../../../tmp/.mount_OpenWhuhwbfu/resources/app.asar/.env // tip: ⌁ auth for agents [www.vestauth.com]
◇ injected env (6) from ../.config/open-whispr/.env // tip: ⌘ override existing { override: true }
[DEBUG] Debug logging enabled {
  logFile: '/home/idris/.config/open-whispr/logs/debug-2026-06-26T06-22-59-154Z.log'
}
✅ Update downloaded successfully: 1.7.3
📥 Download initiated successfully
[DEBUG][meeting] Process list refreshed { count: 617 }
🔄 Installing update and restarting...
❌ Update installation error: TypeError: Cannot read properties of undefined (reading 'preventDefault')
    at EventEmitter.<anonymous> (/tmp/.mount_OpenWhuhwbfu/resources/app.asar/main.js:1579:11)
    at EventEmitter.emit (node:events:520:35)
    at UpdateManager.installUpdate (/tmp/.mount_OpenWhuhwbfu/resources/app.asar/src/updater.js:257:11)
    at /tmp/.mount_OpenWhuhwbfu/resources/app.asar/src/helpers/ipcHandlers.js:6497:33
    at Session.<anonymous> (node:electron/js2c/browser_init:2:116478)
    at Session.emit (node:events:508:28)
Error occurred in handler for 'install-update': TypeError: Cannot read properties of undefined (reading 'preventDefault')
    at EventEmitter.<anonymous> (/tmp/.mount_OpenWhuhwbfu/resources/app.asar/main.js:1579:11)
    at EventEmitter.emit (node:events:520:35)
    at UpdateManager.installUpdate (/tmp/.mount_OpenWhuhwbfu/resources/app.asar/src/updater.js:257:11)
    at /tmp/.mount_OpenWhuhwbfu/resources/app.asar/src/helpers/ipcHandlers.js:6497:33
    at Session.<anonymous> (node:electron/js2c/browser_init:2:116478)
    at Session.emit (node:events:508:28)

fixes #1006

… app.emit("before-quit")

The manual app.emit("before-quit) passed no Event object, causing
event.preventDefault() to throw TypeError; the second click worked only
because the crash left isShuttingDown = true, causing an accidental
early-return.

Use autoUpdater's before-quit-for-update event for pre-quit cleanup.
@gabrielste1n gabrielste1n self-requested a review June 30, 2026 15:27
…toUpdater

electron-updater emits this event on require("electron").autoUpdater (and
Squirrel.Mac emits it there natively before closing windows), not on its own
instance, so the previous listener never fired. Without it, macOS installs
stalled: windowManager.isQuitting stayed false, the control panel prevented
close and hid to tray, and Squirrel waited on window-all-closed forever.

Also shut down sidecars best-effort on the update quit path and drop the
unreachable globalShortcut fallback (hotkeyManager is always set).
@gabrielste1n gabrielste1n force-pushed the fix-auto-update-install-failing branch from da856ab to b2d51fb Compare July 3, 2026 03:00
@gabrielste1n

Copy link
Copy Markdown
Collaborator

thank you legend @IdrisGit !!

@gabrielste1n gabrielste1n merged commit fc6f548 into OpenWhispr:main Jul 3, 2026
6 checks passed
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.

Update not installable

2 participants