Skip to content

Stop the native run loop on quit, not will-quit - #24

Merged
ipfizz merged 1 commit into
mainfrom
fix/quit-veto-keeps-runloop
Sep 5, 2026
Merged

ipfizz merged 1 commit into
mainfrom
fix/quit-veto-keeps-runloop

Conversation

@ipfizz

@ipfizz ipfizz commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Root cause

bootstrap.ts stopped the native run-loop pump on will-quit. That event is cancelable, and the pump stop ran before the veto was honoured, so an app that called event.preventDefault() on will-quit kept running with a dead run loop: no more delegate callbacks, executeJavaScript never settles.

The same ordering is what made the macOS window-events integration file hang when run alone: its first tests closed the last window, the default quit fired, the test exit stub swallowed the exit, and every later native callback was lost. It only passed in the full suite by accident of ordering.

Fix

  • The pump now stops on quit, which fires only after before-quit and will-quit passed without a veto.
  • Regression test in bootstrap.test.ts: a will-quit veto leaves the native app running; a completed quit stops it once. Verified red on the old line, green on the new.
  • The two macOS integration files that close their last window now hold a window-all-closed keep-alive listener (keepAppAlive helper), the way a real macOS app does, and drop it in afterAll.
  • app.md and the changelog describe the sequence.

Verification

bun run validate green locally; window-events.test.ts passes alone; all integration suites pass (209).

@ipfizz
ipfizz merged commit 60b61f0 into main Sep 5, 2026
3 checks passed
@ipfizz
ipfizz deleted the fix/quit-veto-keeps-runloop branch September 5, 2026 22:56
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.

1 participant