From 8544849088c3d3118929cbca0f03969904911a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 27 Nov 2026 15:28:55 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20share=20frames=20freed=20?= =?UTF-8?q?from=20the=20drawing=20window's=20atlas:=20pump=20runs=20in=20o?= =?UTF-8?q?n=5Fnext=5Fframe=20with=20the=20window=20leased,=20so=20drop=5F?= =?UTF-8?q?image(None)=20skipped=20it=20and=20every=20frame's=20texture=20?= =?UTF-8?q?leaked=20VRAM/RAM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/client/src/gui/camera_view.rs | 18 +++++++++++------- crates/client/src/gui/share_view.rs | 6 +++--- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/crates/client/src/gui/camera_view.rs b/crates/client/src/gui/camera_view.rs index 423a0a1..14ef6a1 100644 --- a/crates/client/src/gui/camera_view.rs +++ b/crates/client/src/gui/camera_view.rs @@ -56,7 +56,11 @@ impl Yumush { .collect() } - pub(super) fn tick_tiles(&mut self, cx: &mut Context) -> bool { + pub(super) fn tick_tiles( + &mut self, + mut window: Option<&mut Window>, + cx: &mut Context, + ) -> bool { let wanted = self.tile_sources(); let viewing = self.viewing(); let quality = tile_quality(self.chat.stage); @@ -105,7 +109,7 @@ impl Yumush { .surface .update(cx, |surface, cx| surface.replace(None, cx)) { - cx.drop_image(frame, None); + cx.drop_image(frame, window.as_deref_mut()); } if viewing != Some(source) { let network = self.network.clone(); @@ -132,7 +136,7 @@ impl Yumush { .surface .update(cx, |surface, cx| surface.replace(next, cx)) { - cx.drop_image(old, None); + cx.drop_image(old, window.as_deref_mut()); } } @@ -312,16 +316,16 @@ impl Yumush { fn pump(&mut self, window: &mut Window, cx: &mut Context) { self.pumping = false; self.pumped = Instant::now(); - self.tick_viewer(cx); - self.tick_tiles(cx); + self.tick_viewer(Some(window), cx); + self.tick_tiles(Some(window), cx); self.tick_player(window, cx); self.schedule_pump(window, cx); } fn idle_tick(&mut self, cx: &mut Context) -> bool { if self.pumped.elapsed() > PUMP_STALL { - self.tick_viewer(cx); - self.tick_tiles(cx); + self.tick_viewer(None, cx); + self.tick_tiles(None, cx); } self.streaming() } diff --git a/crates/client/src/gui/share_view.rs b/crates/client/src/gui/share_view.rs index 93a6039..d480f9d 100644 --- a/crates/client/src/gui/share_view.rs +++ b/crates/client/src/gui/share_view.rs @@ -363,7 +363,7 @@ impl Yumush { cx.notify(); } - pub(super) fn tick_viewer(&mut self, cx: &mut Context) { + pub(super) fn tick_viewer(&mut self, mut window: Option<&mut Window>, cx: &mut Context) { let Some(viewer) = self.chat.viewer.as_mut() else { return; }; @@ -385,11 +385,11 @@ impl Yumush { .as_ref() .is_some_and(|current| Arc::ptr_eq(current, &old)) { - cx.drop_image(old, None); + cx.drop_image(old, window.as_deref_mut()); } } if let Some(old) = previous { - cx.drop_image(old, None); + cx.drop_image(old, window); } if appeared { cx.notify();