mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-23 17:10:37 +01:00
f25434f3c5
# Objective Zed on X11 could crash with `index out of bounds: the len is 0 but the index is 0` in `WgpuAtlas::get_texture_info` right after recovering from a lost GPU device (Sentry ZED-BVQ, Linear FR-488). ## Solution When the device is lost, `X11Window::draw` recreates the renderer, which clears the sprite atlas, and sets `force_render_after_recovery` so the next frame rebuilds the scene instead of replaying the cached one. Only the periodic refresh timer consumed that flag though. An `Expose` event handled in the same event loop turn (a compositor repainting after the same GPU reset, for example) requested a presentation-only frame with `force_render: false`, so GPUI presented the previously rendered scene, whose sprites still pointed at atlas textures that no longer exist. We now consume the flag in `X11WindowStatePtr::refresh`, so every frame request, Expose or timer, forces a full render after recovery. The field is private now so a caller can't bypass it again. ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable --- Release Notes: - Fixed a crash on Linux (X11) that could occur when a window was redrawn immediately after recovering from a lost GPU device. - [GPUI] Fixed a crash on Linux (X11) when an `Expose` event presented a cached frame immediately after GPU device recovery.