docs: document Mutex drop pattern in composite_buffer

The compositor is single-threaded — Mutex guards exist only for
Rust borrow-safety. Raw pointers from Vec::as_mut_ptr() remain
valid after guard drop because no concurrent mutation is possible.
This commit is contained in:
2026-05-06 13:05:04 +01:00
parent 6453405159
commit 7e4af94f59
@@ -1096,6 +1096,10 @@ impl Compositor {
}
fn composite_buffer(&self, pool: &mut ShmPool, buffer: &Buffer, surface: &Surface) {
// The compositor is single-threaded (handle_client is blocking).
// Mutex guards are used only for Rust borrow-safety; raw pointers
// obtained from Vec::as_mut_ptr() remain valid after the guard is
// dropped because no other thread can mutate the buffers.
let byte_count = buffer.height as usize * buffer.stride as usize;
if buffer.offset as usize + byte_count > pool.size { return; }