From 873f19dec62b8ea7f1c82a25f15aafe34f3182ec Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Sun, 5 Nov 2023 21:09:41 -0500 Subject: [PATCH] Fix Panic in Surface Configure (#4635) --- wgpu-core/src/device/global.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wgpu-core/src/device/global.rs b/wgpu-core/src/device/global.rs index fa6ece21d4..d8f1c0f5d0 100644 --- a/wgpu-core/src/device/global.rs +++ b/wgpu-core/src/device/global.rs @@ -2296,12 +2296,12 @@ impl Global { log::info!("configuring surface with {:?}", config); let error = 'outer: loop { - let hub = A::hub(self); - let mut token = Token::root(); - // User callbacks must not be called while we are holding locks. let user_callbacks; { + let hub = A::hub(self); + let mut token = Token::root(); + let (mut surface_guard, mut token) = self.surfaces.write(&mut token); let (adapter_guard, mut token) = hub.adapters.read(&mut token); let (device_guard, mut token) = hub.devices.read(&mut token);