From 5ca92bf984ca1c019488f0a62f3f7129fb807901 Mon Sep 17 00:00:00 2001 From: Xiaopeng Li Date: Thu, 21 Nov 2024 17:47:05 +0800 Subject: [PATCH] Fix leaks of WeakVec (#6576) --- wgpu-core/src/weak_vec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wgpu-core/src/weak_vec.rs b/wgpu-core/src/weak_vec.rs index b645cc714..f6034c6e9 100644 --- a/wgpu-core/src/weak_vec.rs +++ b/wgpu-core/src/weak_vec.rs @@ -47,7 +47,7 @@ impl WeakVec { } if let Some(i) = self.empty_slots.pop() { self.inner[i] = Some(value); - self.scan_slots_on_next_push = false; + self.scan_slots_on_next_push = self.empty_slots.is_empty(); } else { self.inner.push(Some(value)); self.scan_slots_on_next_push = self.inner.len() == self.inner.capacity();