mirror of https://github.com/axmolengine/axmol.git
Fix AudioEngine thread concurrency crash between myAlSourceNotificationCallback and _play2d iterating over _audioPlayers. (#18083)
This commit is contained in:
parent
a6773f408a
commit
78818ca275
|
@ -215,6 +215,7 @@ ALvoid AudioEngineImpl::myAlSourceNotificationCallback(ALuint sid, ALuint notifi
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AudioPlayer* player = nullptr;
|
AudioPlayer* player = nullptr;
|
||||||
|
s_instance->_threadMutex.lock();
|
||||||
for (const auto& e : s_instance->_audioPlayers)
|
for (const auto& e : s_instance->_audioPlayers)
|
||||||
{
|
{
|
||||||
player = e.second;
|
player = e.second;
|
||||||
|
@ -223,6 +224,7 @@ ALvoid AudioEngineImpl::myAlSourceNotificationCallback(ALuint sid, ALuint notifi
|
||||||
player->wakeupRotateThread();
|
player->wakeupRotateThread();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
s_instance->_threadMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioEngineImpl::AudioEngineImpl()
|
AudioEngineImpl::AudioEngineImpl()
|
||||||
|
|
Loading…
Reference in New Issue