Commit 12c06a03 authored by nicolas's avatar nicolas

fix(CoreManager): avoid memory leak on ChatModel and use correct sip address key*

parent 922723fd
...@@ -98,10 +98,11 @@ shared_ptr<ChatModel> CoreManager::getChatModelFromSipAddress (const QString &si ...@@ -98,10 +98,11 @@ shared_ptr<ChatModel> CoreManager::getChatModelFromSipAddress (const QString &si
auto deleter = [this](ChatModel *chatModel) { auto deleter = [this](ChatModel *chatModel) {
mChatModels.remove(chatModel->getSipAddress()); mChatModels.remove(chatModel->getSipAddress());
delete chatModel;
}; };
shared_ptr<ChatModel> chatModel(new ChatModel(sipAddress), deleter); shared_ptr<ChatModel> chatModel(new ChatModel(sipAddress), deleter);
mChatModels[sipAddress] = chatModel; mChatModels[chatModel->getSipAddress()] = chatModel;
emit chatModelCreated(chatModel); emit chatModelCreated(chatModel);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment