gpu: saturate bink_movie(false) counter at zero #44
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/44"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from edsuuu/VI-BR-PORT. Originally posted by ahmetbagci8 on 2026-11-29T20:42:24Z.
Problem
In crates/victory-gpu/src/frame.rs, ink_movie(false) executes MOVIES.fetch_sub(1, Ordering::Relaxed). If ink_movie(false) is ever called when MOVIES == 0 (for example closing an unbalanced Bink handle), the counter wraps to u64::MAX, permanently locking the frame pacer into 30 Hz Pacing::Video mode for the rest of the session.
Fix
Use MOVIES.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |n| n.checked_sub(1)) so decrementing at zero is a no-op. Added unit test ink_movie_stop_at_zero_does_not_underflow.
Verification