From 192207d3763a2c3642d883f061e95a55f9dab424 Mon Sep 17 00:00:00 2001 From: Andy Leiserson Date: Wed, 29 Apr 2026 17:01:30 -0700 Subject: [PATCH] fix(core): Fix lock release order in `PendingSubmission` and `Queue::write_buffer` --- wgpu-core/src/device/queue.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/wgpu-core/src/device/queue.rs b/wgpu-core/src/device/queue.rs index b850b48a1..2c74b0dde 100644 --- a/wgpu-core/src/device/queue.rs +++ b/wgpu-core/src/device/queue.rs @@ -635,8 +635,7 @@ impl WebGpuError for QueueSubmitError { /// [`submit`]: `PendingSubmission::submit` pub(crate) struct PendingSubmission<'a> { queue: &'a Queue, - // NOTE: Guards must be declared in reverse of acquisition order, so `wgpu_validate_locks` - // succeeds. + // The lock ordering checker cares about the drop order for these guards. command_index_guard: RwLockWriteGuard<'a, CommandIndices>, snatch_guard: SnatchGuard<'a>, // Command buffers to be executed, along with trackers for the resources they use. @@ -729,12 +728,8 @@ impl Queue { buffer_offset, ); - drop(snatch_guard); - pending_writes.consume(staging_buffer); - drop(pending_writes); - result } @@ -1704,8 +1699,8 @@ impl Queue { let submission = PendingSubmission { queue: self, - snatch_guard, command_index_guard, + snatch_guard, executions: Vec::new(), surface_textures: FastHashMap::default(), index,