Skip to content

fix(runtime): release retained Pixels and image atlas pages when hidden - #2686

Merged
Hona merged 1 commit into
devfrom
fix/hidden-window-drop-pixels
Nov 28, 2026
Merged

Hona merged 1 commit into
devfrom
fix/hidden-window-drop-pixels

Conversation

@Hona

@Hona Hona commented Nov 28, 2026

Copy link
Copy Markdown
Member

Fixes #2675.

Summary

  • Generalizes RuntimeCore::drop_images() (moved from runtime/frame.rs to runtime/rest.rs, previously Wayland-overlay-only) to clear ImageAtlas CPU pages and drop every retained Pixels / Image reference across:
    • tree.nodes (VisualCold::pixels, VisualCold::image_menu, PillChip::image, BareIcon::image, InputSpec::pill_image)
    • tree.spare_nodes
    • commit.memo (tracked via Built::has_pixels / Shared::has_pixels, so memos without images stay cached and image-free windows are not marked dirty)
    • commit.virtual_inputs (InputSpec::pill_image) and commit.virtuals (PinnedSelection::stored elements and offscreen Pins pill images)
  • Calls drop_images() on every unseen/hidden path:
    • Desktop Host: give_back(true) (non-launcher), hide_window, set_cover(covered), and release
    • OverlayCore: give_back(true) and stop_drawing (including Release::Now)
    • Web: commit_hidden before rest()
    • Standalone Runtime: Runtime::rest() when !live_visible(), plus RuntimeCore::finish_update and RuntimeCore::poll_alone when state changes while !live_visible() (without rebuilding the view while hidden)
  • Preserves visible idle rest: visible give_back(false) and visible Runtime::rest() keep currently displayed images and atlas pages warm.
  • Rebuilds cleanly on show: when images were dropped, commit.dirty is set so the next visible frame rebuilds and re-uploads whatever images the view still shows.

Verification

  • Ran focused unit tests on Windows (DX12 headless GPU + CPU runtime tests): runtime::rest::tests (3 new regression tests proving Weak::upgrade() drops to None across El::pixels, memo, clipped memo, pill_with_image, inline_image, pill_image, image_menu, virtualize, hidden rest(), hidden update(), and hidden poll), overlay::rest_tests, overlay::state_walk_tests::wayland_hide_drops_pixels, overlay::tests::overlay_pixels_wake_only_while_shown_and_catch_up_on_show, overlay::retire::tests::drop_hidden_images, render::upload::tests::give_back, runtime::drop_tests, runtime::hidden_wake_tests, runtime::live_only_tests, and window::state::covered_tests (all passed).
  • Ran cargo check -p rune --target wasm32-unknown-unknown (passed).
  • Not run on real macOS/Metal, Linux X11/Wayland, or live browser hardware locally.

@Hona
Hona merged commit 7205f2d into dev Nov 28, 2026
4 checks passed
@Hona
Hona deleted the fix/hidden-window-drop-pixels branch November 28, 2026 00:29
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.

A hidden window keeps the Pixels of its last view after the app drops them

1 participant