From 3029b8c1ee77d40461a1ea5ee98783c562e7fb49 Mon Sep 17 00:00:00 2001 From: JetSetIlly Date: Wed, 11 Dec 2024 09:56:20 +0000 Subject: [PATCH] fixed race condition in MutePeripherals() calling from GUI goroutine required it being pushed to the emulation goroutine --- gui/sdlimgui/sdlimgui.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gui/sdlimgui/sdlimgui.go b/gui/sdlimgui/sdlimgui.go index 12a196435..c12eb5728 100644 --- a/gui/sdlimgui/sdlimgui.go +++ b/gui/sdlimgui/sdlimgui.go @@ -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) }