From 3ee424fc5ba0053eb7a2c8a292a5da3510e425a9 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 a04e98cc61..fb5065dba6 100644 --- a/wgpu-core/src/device/global.rs +++ b/wgpu-core/src/device/global.rs @@ -2107,12 +2107,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);