Repository navigation
fix(desktop): a quit can no longer hang on a fatal main-process error #10396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
30c1912
be9729f
fa41a2d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,21 @@ const MIN_HEIGHT = 600 | |
| const WINDOW_TITLE = 'Sim' | ||
| const BOUNDS_SAVE_DELAY_MS = 400 | ||
| const ROUTE_SAVE_DELAY_MS = 500 | ||
| /** The events Electron's own per-window `visibilityChanged` listener subscribes to. */ | ||
| const VISIBILITY_EVENTS = ['show', 'hide', 'minimize', 'maximize', 'restore'] as const | ||
|
|
||
| /** | ||
| * Drops a closed window's visibility listeners. macOS can deliver a window's | ||
| * `show` (an occlusion change) after the window has closed and been destroyed, | ||
| * as when the app quits just as its first window appears; Electron's own | ||
| * listener then reads `isVisible()` from the dead window and throws "Object has | ||
| * been destroyed" as an uncaught main-process exception during shutdown. | ||
| */ | ||
| export function detachVisibilityListenersOnClose(win: BrowserWindow): void { | ||
| win.once('closed', () => { | ||
| for (const event of VISIBILITY_EVENTS) win.removeAllListeners(event) | ||
| }) | ||
|
Comment on lines
+33
to
+35
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Guard the listener with |
||
| } | ||
|
|
||
| /** | ||
| * The permission matrix: sanitized clipboard writes and microphone access for | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
settlePrompt()redefines the existingflushMicrotasks()helper. The testing guide requires using shared helpers instead of redefining them. Replace this function withflushMicrotasks(5)from@sim/testing/helpers/async, adding the workspace dependency if needed.This repository requirement must be satisfied before merging.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!