Clean up image resources for the current window (#45969)

Closes https://github.com/zed-industries/zed/issues/35894

Trace:
https://drive.google.com/file/d/1pXDFzOg4ZS4p2SX8fk9Cjnyy1Qd1Pkrx/view?usp=sharing
[Relevant
part](https://github.com/user-attachments/files/24412472/image_leak.txt)


Release Notes:

- Fixed a memory leak when opening images
This commit is contained in:
Kirill Bulatov 2026-01-03 00:21:11 +02:00 committed by GitHub
parent e1a09e290c
commit 94faaebfec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -44,7 +44,7 @@ impl ImageView {
cx.on_release_in(window, |this, window, cx| {
let image_data = this.image_item.read(cx).image.clone();
if let Some(image) = image_data.clone().get_render_image(window, cx) {
cx.drop_image(image, None);
cx.drop_image(image, Some(window));
}
image_data.remove_asset(cx);
})