Skip to content

Commit

Permalink
Pop Message from queue after use to fix reference lifespan
Browse files Browse the repository at this point in the history
  • Loading branch information
territo-sci authored and emiax committed Jul 7, 2018
1 parent 0783b1d commit c2b1a3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/server/servermodule.cpp
Expand Up @@ -140,10 +140,10 @@ void ServerModule::consumeMessages() {
std::lock_guard<std::mutex> lock(_messageQueueMutex); std::lock_guard<std::mutex> lock(_messageQueueMutex);
while (!_messageQueue.empty()) { while (!_messageQueue.empty()) {
const Message& m = _messageQueue.front(); const Message& m = _messageQueue.front();
_messageQueue.pop_front();
if (std::shared_ptr<Connection> c = m.connection.lock()) { if (std::shared_ptr<Connection> c = m.connection.lock()) {
c->handleMessage(m.messageString); c->handleMessage(m.messageString);
} }
_messageQueue.pop_front();
} }
} }


Expand Down

0 comments on commit c2b1a3f

Please sign in to comment.