When atlas tiles are rapidly allocated and freed (e.g. watching a shared
screen in Collab), a texture can become unreferenced and be removed
while GPU uploads for it are still pending. On the next frame,
`flush_uploads` indexes into the now-empty texture slot and panics:
```
thread 'main' panicked at crates/gpui_wgpu/src/wgpu_atlas.rs:231:40:
texture must exist...
#11 core::option::expect_failed
#12 gpui_wgpu::wgpu_atlas::WgpuAtlas::before_frame
#13 gpui_wgpu::wgpu_renderer::WgpuRenderer::draw
```
This change drains pending uploads for a texture when it becomes
unreferenced in `remove`, and skips uploads for missing textures in
`flush_uploads` as a safety net.
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 is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Release Notes:
- Fixed occasional crashes when viewing a screen share