From 701de698d484f9d4dc7c66e3caf5ddeb9baf872d Mon Sep 17 00:00:00 2001 From: Kevin Mehall Date: Tue, 28 Jul 2026 05:33:43 -0600 Subject: [PATCH] web: Avoid panic from lost texture updates when loaded on a background tab (#8313) The `textures_delta` in `AppRunner::logic()` comes from `TextureManager::take_delta()` via `end_pass()`. Previously, if `is_visible` was `false`, these deltas would have been dropped and never applied, so the `TextureManager` state gets out of sync with the `Renderer`. That causes https://github.com/emilk/egui/issues/8228: When the app is loaded in a background tab and the first frame occurs via the `setTimeout` path prior to the tab becoming visible, it loses the `ImageDelta` representing the initial creation of the font atlas texture. When the user then switches to the tab, it panics at crates/egui-wgpu/src/renderer.rs:669:18 with `Tried to update a texture that has not been allocated yet` when attempting to update the texture that the wgpu renderer never saw when it was created. Testing: To make it load in a background tab, put `data:text/html,Click` in the address bar and then middle click the resulting link. On Chrome you also have to hover the tab preview before switching to the tab to reproduce the issue. * Closes and its duplicate https://github.com/emilk/egui/issues/8278 * [x] I have followed the instructions in the PR template Co-authored-by: Emil Ernerfeldt --- crates/eframe/src/web/app_runner.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/eframe/src/web/app_runner.rs b/crates/eframe/src/web/app_runner.rs index 3caa2428a..e259e4019 100644 --- a/crates/eframe/src/web/app_runner.rs +++ b/crates/eframe/src/web/app_runner.rs @@ -316,7 +316,7 @@ impl AppRunner { } self.handle_platform_output(platform_output); - if is_visible { + if is_visible || !textures_delta.is_empty() { self.textures_delta.append(textures_delta); self.clipped_primitives = Some(self.egui_ctx.tessellate(shapes, pixels_per_point)); }