Fixed two music bot hangups

This commit is contained in:
WolverinDEV 2020-03-26 17:34:31 +01:00
parent 0778b04b6b
commit b7b22dc89e
3 changed files with 8 additions and 5 deletions

View File

@ -30,9 +30,12 @@ void AbstractMusicPlayer::unregisterEventHandler(const std::string& string) {
}
void AbstractMusicPlayer::fireEvent(MusicEvent event) {
std::lock_guard lock(this->eventLock);
auto listCopy = this->eventHandlers; //Copy for remove while fire
for(const auto& entry : listCopy)
decltype(this->eventHandlers) handlers{};
{
std::lock_guard lock(this->eventLock);
handlers = this->eventHandlers; //Copy for remove while fire
}
for(const auto& entry : handlers)
entry.second(event);
}

@ -1 +1 @@
Subproject commit 71efb006ebdce2740e652306df36e34465a21dfc
Subproject commit 5f28af18dabd2ee8f3370bf564c1e287acad3af2

2
music

@ -1 +1 @@
Subproject commit ed56872346f5e90320e62bf1b5e02466fb866b2e
Subproject commit e40ea16703252b64e1e8b744e7bd5cbc88e2941e