Skip to content

Commit

Permalink
fixed race condition in MutePeripherals()
Browse files Browse the repository at this point in the history
calling from GUI goroutine required it being pushed to the
emulation goroutine
  • Loading branch information
JetSetIlly committed Dec 14, 2024
1 parent b8eea8a commit 3029b8c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions gui/sdlimgui/sdlimgui.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,15 +394,17 @@ func (img *SdlImgui) applyAudioMutePreference() {
return
}

// mute any sound producing peripherals attached to the VCS. the call to
// MutePeripherals() must be done in the emulation goroutine
var mute bool

if img.isPlaymode() {
mute = img.prefs.audioMutePlaymode.Get().(bool)
img.dbg.VCS().RIOT.Ports.MutePeripherals(mute)
} else {
mute = img.prefs.audioMuteDebugger.Get().(bool)
img.dbg.VCS().RIOT.Ports.MutePeripherals(mute)
}
img.dbg.PushFunction(func() {
img.dbg.VCS().RIOT.Ports.MutePeripherals(mute)
})

img.audio.Mute(mute)
}
Expand Down

0 comments on commit 3029b8c

Please sign in to comment.