Fix AudioEngine thread concurrency crash between myAlSourceNotificationCallback and _play2d iterating over _audioPlayers. (#18083)

This commit is contained in:
Felippe Durán 2017-07-18 00:12:20 -03:00 committed by minggo
parent a6773f408a
commit 78818ca275
1 changed files with 2 additions and 0 deletions

View File

@ -215,6 +215,7 @@ ALvoid AudioEngineImpl::myAlSourceNotificationCallback(ALuint sid, ALuint notifi
return;
AudioPlayer* player = nullptr;
s_instance->_threadMutex.lock();
for (const auto& e : s_instance->_audioPlayers)
{
player = e.second;
@ -223,6 +224,7 @@ ALvoid AudioEngineImpl::myAlSourceNotificationCallback(ALuint sid, ALuint notifi
player->wakeupRotateThread();
}
}
s_instance->_threadMutex.unlock();
}
AudioEngineImpl::AudioEngineImpl()