Skip to content

Commit

Permalink
Unlock mutex sooner to prevent unrecoverable game freeze
Browse files Browse the repository at this point in the history
  • Loading branch information
RubberDuckShobe committed Mar 30, 2024
1 parent 4ed69fe commit 10cb4ab
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/hooking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ unsafe extern "thiscall" fn precalcsong_call_hook(this: *mut A3d_Channel) {

debug!("PreCalc with source {}", song_source);

let mut global_data = state::GLOBAL_DATA.lock().unwrap();
global_data.current_mbid = None;
global_data.current_release_mbid = None;
// Seperate scope to unlock mutex sooner
{
let mut global_data = state::GLOBAL_DATA.lock().unwrap();
global_data.current_mbid = None;
global_data.current_release_mbid = None;
}

// 0 = File
// 1 = CD
Expand Down

0 comments on commit 10cb4ab

Please sign in to comment.