Skip to content

Commit

Permalink
AUDIO: (FM-Towns/PC-98) - deconstructor/race condition fix
Browse files Browse the repository at this point in the history
(move mixer calls before mutex lock, since the mixer has a mutex of its own)
  • Loading branch information
athrxx committed Aug 25, 2019
1 parent 5b5a89e commit d097768
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion audio/softsynth/fmtowns_pc98/pc98_audio.cpp
Expand Up @@ -80,9 +80,9 @@ PC98AudioCoreInternal::PC98AudioCoreInternal(Audio::Mixer *mixer, PC98AudioCore
}

PC98AudioCoreInternal::~PC98AudioCoreInternal() {
deinit();
Common::StackLock lock(_mutex);
_ready = false;
deinit();

/*
Expand Down
2 changes: 1 addition & 1 deletion audio/softsynth/fmtowns_pc98/towns_audio.cpp
Expand Up @@ -404,9 +404,9 @@ TownsAudioInterfaceInternal::TownsAudioInterfaceInternal(Audio::Mixer *mixer, To
}

TownsAudioInterfaceInternal::~TownsAudioInterfaceInternal() {
deinit();
Common::StackLock lock(_mutex);
_ready = false;
deinit();

delete[] _fmSaveReg[0];
delete[] _fmSaveReg[1];
Expand Down
3 changes: 1 addition & 2 deletions audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp
Expand Up @@ -1347,9 +1347,8 @@ int TownsPC98_FmSynth::getRate() const {
}

void TownsPC98_FmSynth::deinit() {
Common::StackLock lock(_mutex);
_ready = false;
_mixer->stopHandle(_soundHandle);
_ready = false;
_timers[0].cb = _timers[1].cb = &TownsPC98_FmSynth::idleTimerCallback;
}

Expand Down

0 comments on commit d097768

Please sign in to comment.