1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(offlinemsg): don't invalidate iterator before use

QMap::erase invalidates the iterator, meaning our usage of it on the
next line was unsafe.
This commit is contained in:
Anthony Bilinski 2019-11-25 13:50:24 -08:00
parent 479b39f536
commit 1f80173b2d
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C

View File

@ -139,8 +139,8 @@ void OfflineMsgEngine::removeAllMessages()
void OfflineMsgEngine::completeMessage(QMap<ReceiptNum, OfflineMessage>::iterator msgIt)
{
msgIt->completionFn();
sentMessages.erase(msgIt);
receivedReceipts.removeOne(msgIt.key());
sentMessages.erase(msgIt);
}
void OfflineMsgEngine::checkForCompleteMessages(ReceiptNum receipt)