mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
Avoid a deadlock in Device::lose (#5197)
This commit is contained in:
parent
563d9202c3
commit
4da46f35ef
@ -3362,9 +3362,11 @@ impl<A: HalApi> Device<A> {
|
||||
// 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());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user