diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index 78f7ddee0..4f6f1c14b 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -3362,9 +3362,11 @@ impl Device { // 1) Resolve the GPUDevice device.lost promise. let mut life_lock = self.lock_life(); let closure = life_lock.device_lost_closure.take(); + // It's important to not hold the lock while calling the closure and while calling + // release_gpu_resources which may take the lock again. + drop(life_lock); + if let Some(device_lost_closure) = closure { - // It's important to not hold the lock while calling the closure. - drop(life_lock); device_lost_closure.call(DeviceLostReason::Unknown, message.to_string()); }