mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-21 23:11:01 +01:00
fix(core): Fix lock order violation in release_gpu_resources
This commit is contained in:
1 parent
83062dd4cd
commit
eaa3de5045
1 file changed
+16
-9
@@ -5654,17 +5654,24 @@ impl Device {
|
||||
// initiate movement into those buckets, and it can do that by calling
|
||||
// "destroy" on all the resources we know about.
|
||||
|
||||
// During these iterations, we discard all errors. We don't care!
|
||||
let trackers = self.trackers.lock();
|
||||
for buffer in trackers.buffers.used_resources() {
|
||||
if let Some(buffer) = Weak::upgrade(buffer) {
|
||||
buffer.destroy();
|
||||
}
|
||||
let buffers = trackers
|
||||
.buffers
|
||||
.used_resources()
|
||||
.flat_map(Weak::upgrade)
|
||||
.collect::<Vec<_>>();
|
||||
let textures = trackers
|
||||
.textures
|
||||
.used_resources()
|
||||
.flat_map(Weak::upgrade)
|
||||
.collect::<Vec<_>>();
|
||||
drop(trackers);
|
||||
|
||||
for buffer in buffers {
|
||||
buffer.destroy();
|
||||
}
|
||||
for texture in trackers.textures.used_resources() {
|
||||
if let Some(texture) = Weak::upgrade(texture) {
|
||||
texture.destroy();
|
||||
}
|
||||
for texture in textures {
|
||||
texture.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user