Permalink
Browse files

Pop Message from queue after use to fix reference lifespan

  • Loading branch information...
territo-sci authored and emiax committed Jul 7, 2018
1 parent 0783b1d commit c2b1a3fd42b107ed37a1d0006058ae9d2df4baaf
Showing with 1 addition and 1 deletion.
  1. +1 −1 modules/server/servermodule.cpp
@@ -140,10 +140,10 @@ void ServerModule::consumeMessages() {
std::lock_guard<std::mutex> lock(_messageQueueMutex);
while (!_messageQueue.empty()) {
const Message& m = _messageQueue.front();
_messageQueue.pop_front();
if (std::shared_ptr<Connection> c = m.connection.lock()) {
c->handleMessage(m.messageString);
}
_messageQueue.pop_front();
}
}

0 comments on commit c2b1a3f

Please sign in to comment.