From 459774082f735b2a67318c8fca8a3ed203df8589 Mon Sep 17 00:00:00 2001 From: "zed-zippy[bot]" <234243425+zed-zippy[bot]@users.noreply.github.com> Date: Fri, 2 Jan 2026 22:34:17 +0000 Subject: [PATCH] Clean up image resources for the current window (#45969) (cherry-pick to preview) (#45970) Cherry-pick of #45969 to preview ---- 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 Co-authored-by: Kirill Bulatov --- crates/image_viewer/src/image_viewer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/image_viewer/src/image_viewer.rs b/crates/image_viewer/src/image_viewer.rs index d7c2341723e798b18d559895d6ea478b491eeaf7..ffb8cbddf29c0ad512aa4392e3a8afa5d5c14936 100644 --- a/crates/image_viewer/src/image_viewer.rs +++ b/crates/image_viewer/src/image_viewer.rs @@ -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); })