From 9046c8d39a96102bd1c8839cb109aa0e22ff71d6 Mon Sep 17 00:00:00 2001 From: arnav-hiwarkar Date: Thu, 12 Nov 2026 20:03:35 +0530 Subject: [PATCH] #2042: read the Project panel thumbnail through panels::project::cached_thumbnail ui_large_project::comp_thumbnail_renders_off_the_ui_thread read the thumbnail cache by its old storage type, (u64, TextureHandle), which the purge change replaced with a private newtype, so it never saw the texture land. It now asks cached_thumbnail. --- crates/ui-egui/src/panels/project.rs | 5 +++++ crates/ui-egui/tests/it/ui_large_project.rs | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/panels/project.rs b/crates/ui-egui/src/panels/project.rs index bc03d282f..0d8074934 100644 --- a/crates/ui-egui/src/panels/project.rs +++ b/crates/ui-egui/src/panels/project.rs @@ -127,6 +127,11 @@ struct Thumb(u64, egui::TextureHandle); #[derive(Clone)] struct PendingThumb(u64, Arc)>>>>); +/// The Project panel's thumbnail texture of `item`, once its render has landed. +pub fn cached_thumbnail(ctx: &egui::Context, item: ItemId) -> Option { + ctx.data(|d| d.get_temp::(egui::Id::unique(("proj-thumb", item.0)))).map(|Thumb(_, t)| t) +} + /// Let go of every Project panel thumbnail and the renders in flight for them (a cache purge, or /// a project closed: the next project's item ids can be the closed one's). pub fn forget_thumbnails(ctx: &egui::Context) { diff --git a/crates/ui-egui/tests/it/ui_large_project.rs b/crates/ui-egui/tests/it/ui_large_project.rs index 4e2476269..2310087e3 100644 --- a/crates/ui-egui/tests/it/ui_large_project.rs +++ b/crates/ui-egui/tests/it/ui_large_project.rs @@ -64,9 +64,7 @@ fn comp_thumbnail_renders_off_the_ui_thread() { let mut landed = false; for _ in 0..400 { h.step(); - if h.state().auto.find("project.thumbnail").is_some() - && h.ctx.data(|d| d.get_temp::<(u64, egui::TextureHandle)>(egui::Id::unique(("proj-thumb", main.0)))).is_some() - { + if h.state().auto.find("project.thumbnail").is_some() && effectcraft_ui_egui::panels::project::cached_thumbnail(&h.ctx, main).is_some() { landed = true; break; }