Skip to content

fix(desktop): no destroyed-object error when quitting with browser tabs - #656

Merged
lastobelus merged 1 commit into
lastcode/mainfrom
lastcode/fix-browser-shutdown
Nov 8, 2026
Merged

lastobelus merged 1 commit into
lastcode/mainfrom
lastcode/fix-browser-shutdown

Conversation

@lastobelus

@lastobelus lastobelus commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Quitting with embedded browser tabs open could throw an uncaught Object has been destroyed error from rendererRenderingActive in DesktopBrowserHost.ts, which delayed an update.

Fix

All in apps/desktop/src/preview/DesktopBrowserHost.ts:

  • Native reads: a new liveHostWebContents helper returns the host only when neither the guest nor the host is destroyed. Every guest.hostWebContents read now goes through it.
  • Lifecycle sync: syncNativeLifetime skips destroyed tabs. The queued lifecycle update now checks for destruction before it calls renderingActive, avoiding another path to the same unsafe read.
  • Disposal: a disposed flag, set in the scope finalizer, stops syncNativeLifetime, scheduleNativeLifetime and the queued tab and popup lifecycle updates once the host is torn down.

Validation

  • Five new regression cases in DesktopBrowserHost.test.ts failed before the fix. All 103 browser-host tests pass after it.
  • Changed-file checks and Quick CI passed at the exact head and base.
  • A real Electron reproduction, run in the background and isolated (no windows, no live state), fails before the fix and passes after it.

Scope

No change to signing or Screen Recording behavior.

Local review: 2 rounds with claude-opus-5-5 (high) and gpt-6.1-terra (xhigh), approved.

Implemented with GPT-6.1 Sol (xhigh) through the Codex harness in T3 Code.

@lastobelus lastobelus changed the title fix(desktop): avoid destroyed browser objects during shutdown fix(desktop): no destroyed-object error when quitting with browser tabs Nov 8, 2026
@lastobelus
lastobelus marked this pull request as ready for review November 8, 2026 23:26
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T23:39:30.365014Z cb496e8 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 411047fc97

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Check guest and host lifetime before reading native browser state, and stop queued lifecycle synchronization after disposal.

Carry-Group: incubator

Carry-Observation: Browser preview teardown must tolerate native destruction before pending lifetime callbacks run.
@lastobelus
lastobelus force-pushed the lastcode/fix-browser-shutdown branch from 411047f to cb496e8 Compare November 8, 2026 23:37
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: cb496e88b8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lastobelus
lastobelus merged commit a120913 into lastcode/main Nov 8, 2026
20 checks passed
@lastobelus
lastobelus deleted the lastcode/fix-browser-shutdown branch November 8, 2026 23:46
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