Repository navigation
fix(native): fix re-entrant settings close, updates test teardown, and settle offscreen captures - #466
Merged
Conversation
…down, and settle offscreen snapshot frames
This was referenced Nov 20, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #202
Summary
Entity<SettingsView>::updatepanic on Settings close (apps/native/crates/app/src/settings/mod.rs):SettingsView::on_closeran inside an activeSettingsViewentity update and calledfinish_close(window, cx), which calledview.update(cx, ...)on the sameSettingsViewentity to cancelappearance_ui.import, panicking withcannot update t3_native::settings::SettingsView while it is already being updated.clear_closed_host(window, cx)andSettingsView::cancel_pending_import(&mut self, cx)so external callers (close, tests viafinish_close) still updateSettingsViewto cancel pending imports before clearingHost, whileSettingsView::on_closecancels pending imports directly on&mut selfwithout re-borrowing the entity.HeadlessAppContextAppStatehandle leak inupdates::tests(apps/native/crates/app/src/updates/tests.rs):updates::tests::disconnected_saved_environment_uses_saved_labeldroppedHeadlessAppContextwithout stopping theAppStatepump or draining parked tasks, triggering GPUI'sLeakDetectorpanic.state.update(&mut cx, |state, _| state.stop_pump()); drop(_loaded); drop(state); cx.run_until_parked();teardown soupdates::testspasses 11/11 under--features snapshot.#202and harden offscreen capture settling (apps/native/crates/app/src/snapshot.rs):zeronsh/zui(667d0aaf9531d2d1b2d0674a5e55f977df1b09f6):MetalAtlas::removeonly runs viaWindow::drop_imageforpolychrome_textures),LineLayoutCache(immutableArc<LineLayout>two-frame swap), andScene::replay/BoundsTree/BatchIteratorprimitive loss. Verified multi-page monochrome atlas overflow (3 textures), locale switching (-AppleLocale lt_LT/ug_CN), Local ACP dark/light scroll, and split.cached()sidebar +ThreadView+ scrollable Markdown preview.snapshot.rs: (a) the final capture issued a singlewindow.refresh()immediately beforecx.capture_screenshot(window)without drainingon_next_framecallbacks (simulate_next_frame) or re-refreshing if a draw/effect queued follow-up work; (b)--motion-framescalledcapture_screenshotdirectly afterpumpwithoutwindow.refresh().zeronsh/zui(667d0aa) offscreen hazards that require an upstreamzuipatch (hencePart of #202rather than closing):MacWindow::render_to_image(gpui_macos/src/metal_renderer.rs:657-748) uses a liveCAMetalLayer(set_maximum_drawable_count(2)) on anorderFront_offscreenNSWindowwithout anobjc::rc::autoreleasepoolwrapper (unlikeMetalRenderer::draw) orblit.synchronize_resourcefor non-unified GPUs (unlikerender_scene_to_image), whileMacWindow::frame_requesterstill armsCVDisplayLinkwhen visible; andTestWindow::window_handle(gpui/src/platform/test/window.rs:50) isunimplemented!(), blocking full-app migration (gpui_component::Root/Input) toHeadlessAppContext/MetalHeadlessRenderer.settle_and_captureinsnapshot.rs(boundedsimulate_next_frame+run_until_parked+ fullwindow.refresh(), preserving selection, virtualization, and all bounded caches) andwindow.refresh()before each--motion-framesreadback.--features snapshotregression testsnapshot::tests::offscreen_capture_retains_static_and_cached_text_after_scroll_and_refreshverifying that a.cached()static sidebar and populatedThreadViewretain visible non-background text pixels across preview scroll (both cached replay and full refresh) and Light/Dark theme cycling, with zero.pngartifacts committed.Verification
vp fmt --check apps/native/parity/LEDGER.md: PASSnode apps/native/scripts/gen-theme.ts --check: PASSnode apps/native/conformance/generate.ts --check: PASSnode --test apps/native/parity/sync.test.ts: 47 passed, 0 failedCARGO_INCREMENTAL=0 cargo clippy --manifest-path apps/native/Cargo.toml --workspace --all-targets -- -D warnings: PASS (0 warnings)CARGO_INCREMENTAL=0 cargo test --manifest-path apps/native/Cargo.toml -p t3-core: 1,883 unit + 8 conformance = 1,891 passed, 0 failedCARGO_INCREMENTAL=0 cargo test --manifest-path apps/native/Cargo.toml -p t3-client -- --test-threads=1: 171 passed, 0 failedT3_NATIVE_HOME=$(mktemp -d) CARGO_INCREMENTAL=0 cargo test --manifest-path apps/native/Cargo.toml -p t3-native -- --test-threads=1: 222 passed, 0 failedT3_NATIVE_HOME=$(mktemp -d) CARGO_INCREMENTAL=0 cargo test --manifest-path apps/native/Cargo.toml -p t3-native --features snapshot -- --test-threads=1 updates::tests snapshot: 23 passed, 0 failed (11/11updates::tests+ new#202regression test)CARGO_INCREMENTAL=0 cargo build --manifest-path apps/native/Cargo.toml -p t3-native: PASSBuilt with Antigravity