# image_viewer: Fix texture leak when reloading images \(\#58803\) · gitcafe/zed

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

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

Visibility: public

Requested revision: a473ea63a8bc199a73a7e44de3e1d9252e3ca895

Requested commit: a473ea63a8bc199a73a7e44de3e1d9252e3ca895

Commit: a473ea63a8bc199a73a7e44de3e1d9252e3ca895

Tree: 6a0b501f4b98853f84e6c688458136e9c8d4c9ea

Author: Ron Harel

Committer: GitHub

## Message

```
image_viewer: Fix texture leak when reloading images (#58803)

When the image viewer reloads an image after the underlying file
changes, it now tracks the `RenderImage` currently displayed by the view
and drops that image’s atlas entry before replacing it with a newly
decoded render image. This prevents rapidly updated images from
accumulating atlas textures per reload while keeping cleanup scoped to
the window that displayed the image.

Closes #35894

Release Notes:

- Fixed a memory leak when previewing images that are repeatedly updated
on disk.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
```

## Parents

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

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