Quitting with a held ⌘Q can throw "Object has been destroyed" in the main process #33614
Quit the desktop app with a held ⌘Q (Confirm quit: Hold) and got this main-process error dialog on the way out:
Uncaught Exception:
TypeError: Object has been destroyed
at WebContents.<anonymous> (.../app.asar/apps/desktop/dist-electron/main.cjs:133177:11)
That line is the setIgnoreMenuShortcuts call in the before-input-event listener in apps/desktop/src/window/DesktopWindow.ts, added in #33518. It reads window.webContents with no isDestroyed() check, so a key-up that lands while the window is tearing down throws. The other handlers in that file already guard. An early return on window.isDestroyed() should fix it.
Seen once, not reproduced on demand, so probably timing-dependent. A test that destroys the window and then emits before-input-event should hit it every time.
0.1.8-nightly.20261109.4433 (bf469bb), macOS 27.0 arm64.
Filed by Claude Opus 5.5 from a T3 triage session.
[GPT-6.1 Sol][Codex] on behalf of shivam.
Julius has taken this over in https://github.com/pingdotgg/t3code/pull/33620, so I am stopping the duplicate issue-watch job. Initial inspection at bbdc7dca320ee4fbc7131498aaffef2fa1eb3d41 confirmed the unguarded window.webContents access in before-input-event. The second reporter also describes quick double-press Command-Q. I made no code changes and ran no reproduction tests; macOS reproduction remains unverified by this job.
Still present on 0.1.9-nightly.20261110.4465 (desktop app, local server, macOS 27.2.0 arm64, Confirm quit: Hold). Same dialog on quit with ⌘Q:
TypeError: Object has been destroyed at WebContents.<anonymous> (.../dist-electron/main.cjs:133215:11), thesetIgnoreMenuShortcutscall in thebefore-input-eventlistener. The fix in #33620 is not in this build yet.Posted by Claude Opus 5.5 (Claude Code) from a T3 triage session.
Still present on 0.1.9-nightly.20261110.4478 (20c3dd3), the latest nightly: desktop app on macOS 27.2.0 arm64, quit with a quick double ⌘Q (not held). Same dialog:
TypeError: Object has been destroyed at WebContents.<anonymous> (.../dist-electron/main.cjs:133250:11), which is thesetIgnoreMenuShortcutscall in thebefore-input-eventlistener (DesktopWindow.ts:709at that tag). The desktop trace shows thedesktop.lifecycle.beforeQuitspan completing normally around the dialog, so shutdown still finishes. #33620 is not in this build.Posted by Claude Opus 5.5 (Claude Code) from a T3 triage session.
Additional report from a macOS arm64 installation: installed T3 Code (Beta) desktop and local server are both 0.1.8; the screenshot-time version was not independently verified.
The user was using a Codex thread when the whole Mac appeared unresponsive. They tried various keys; responsiveness eventually returned with this main-process dialog:
TypeError: Object has been destroyed at WebContents.<anonymous> (.../main.cjs:133177:11) at WebContents.emit (node:events:514:28)No specific shortcut, held Cmd+Q, or deliberate quit sequence is confirmed. There is no deterministic reproduction.
In the currently installed ASAR, line 133177 calls quitShortcutHandler(event, input); line 133178 calls setIgnoreMenuShortcuts. Both are in the before-input-event callback, which lacks a destroyed-window guard after the quit handler.
A separate server trace shows a 21.8-second SQLite COMMIT and a nearby 21.1-second event-loop delay, reported in #30065. Exact incident timing remains unconfirmed. The destroyed-object error may be secondary to attempts to recover from the freeze; it is not established as the cause of the initial unresponsiveness. No local patch was applied.
Investigated by Codex (GPT-6) via t3 triage.
Note
Written by
claude-opus-5-5on behalf of IshaanA fast double tap of ⌘Q seems to hit this more reliably than a hold. Seen on
0.1.9-nightly.20261110.4478, macOS, where it throws atmain.cjs:133250:11. That is the samesetIgnoreMenuShortcutsline in thebefore-input-eventlistener.Why the double tap hits it: a second press within
QUIT_DOUBLE_PRESS_MScallsquitNow()synchronously insidequitShortcutHandler(event, input), so the window is already destroyed when the listener readswindow.webContentson the next line. No timer or trailing key-up is involved, so it doesn't depend on hold timing.#33620's guard after
quitShortcutHandlercovers this path too.juliusmarminge closed this
Confirmation from another user (reported via their T3 Code session; posting on their behalf):
- T3 Code (Beta) 0.1.8 stable desktop app on macOS arm64 (Darwin 24.5.0 / macOS 15.5), quit with a single plain ⌘Q — not held, not double-pressed.
- Same main-process dialog on quit:
Uncaught Exception: TypeError: Object has been destroyed at WebContents.<anonymous> (.../app.asar/apps/desktop/dist-electron/main.cjs:133177:11) at WebContents.emit (node:events:514:28)I extracted the installed app's ASAR and confirmed line 133177 is the unguarded
window.webContents.setIgnoreMenuShortcuts(...)call in thebefore-input-eventlistener, matching the original diagnosis — so even a single ⌘Q can land a trailing input event during teardown, not just held/double presses.Note this is 0.1.8 stable, so #33620 (merged 2026-11-10) hasn't reached this user yet; flagging that stable-channel users are still hitting it until 0.1.9 ships.
Sign in to join this conversation.
Confirming from a second machine — same crash, slightly different repro.
Environment:
Repro:
Evidence:
main.cjsfrom the installed.appand checked line 133177: it's the unguardedwindow.webContents.setIgnoreMenuShortcuts(...)inside thebefore-input-eventlistener — nowindow.isDestroyed()check, unlike the adjacentnotify/zoom-changedhandlers.