# gpui_linux: Force a full render on X11 Expose after GPU recovery \(\#64570\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/f25434f3c5a895d52f402ab05c079aa6703825c1)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: f25434f3c5a895d52f402ab05c079aa6703825c1

Requested commit: f25434f3c5a895d52f402ab05c079aa6703825c1

Commit: f25434f3c5a895d52f402ab05c079aa6703825c1

Tree: 125e6b6deadb400dbf3b07d85c326825eea99a3d

Author: Agus Zubiaga

Committer: GitHub

## Message

```
gpui_linux: Force a full render on X11 Expose after GPU recovery (#64570)

# 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.
```

## Parents

- [fcee4a5a4cf6f3efca8460d1d43d0e6468b8414d](https://git.cafe/gitcafe/zed/commit/fcee4a5a4cf6f3efca8460d1d43d0e6468b8414d?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/f25434f3c5a895d52f402ab05c079aa6703825c1?format=markdown)
