feat(CoreManager): add a assert in getChatModel to check if a chat room was correctly removed

This commit is contained in:
Ronan Abhamon 2018-08-23 10:31:00 +02:00
parent 275960f869
commit ebf1d8da84

View file

@ -120,7 +120,8 @@ shared_ptr<ChatModel> CoreManager::getChatModel (const QString &peerAddress, con
Q_ASSERT(mCore->createAddress(Utils::appStringToCoreString(localAddress)));
auto deleter = [this, chatModelId](ChatModel *chatModel) {
mChatModels.remove(chatModelId);
bool removed = mChatModels.remove(chatModelId);
Q_ASSERT(removed);
delete chatModel;
};
@ -134,7 +135,7 @@ shared_ptr<ChatModel> CoreManager::getChatModel (const QString &peerAddress, con
// Returns an existing chat model.
shared_ptr<ChatModel> chatModel = mChatModels[chatModelId].lock();
Q_CHECK_PTR(chatModel.get());
Q_CHECK_PTR(chatModel);
return chatModel;
}