Acquire mutex before modifying variable in wxSoundSyncOnlyAdaptor
The mutex must be locked to avoid data races with the thread actually playing the sound.
This commit is contained in:
@@ -386,14 +386,11 @@ void wxSoundSyncOnlyAdaptor::Stop()
|
||||
wxLogTrace(wxT("sound"), wxT("asking audio to stop"));
|
||||
|
||||
#if wxUSE_THREADS
|
||||
m_mutexRightToPlay.Lock();
|
||||
|
||||
// tell the player thread (if running) to stop playback ASAP:
|
||||
m_status.m_stopRequested = true;
|
||||
|
||||
// acquire the mutex to be sure no sound is being played, then
|
||||
// release it because we don't need it for anything (the effect of this
|
||||
// is that calling thread will wait until playback thread reacts to
|
||||
// our request to interrupt playback):
|
||||
m_mutexRightToPlay.Lock();
|
||||
m_mutexRightToPlay.Unlock();
|
||||
wxLogTrace(wxT("sound"), wxT("audio was stopped"));
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user