try to fix read access violation (Mantis 0013842)
This commit is contained in:
parent
0614520e5a
commit
672ae55ea6
3 changed files with 15 additions and 10 deletions
|
|
@ -83,15 +83,19 @@ void MagicSearchModel::onSearchResultsReceived(const std::shared_ptr<linphone::M
|
||||||
auto ldapFriends = ToolModel::getLdapFriendList();
|
auto ldapFriends = ToolModel::getLdapFriendList();
|
||||||
emit searchResultsReceived(results);
|
emit searchResultsReceived(results);
|
||||||
for (auto result : results) {
|
for (auto result : results) {
|
||||||
|
if (!result) continue;
|
||||||
auto f = result->getFriend();
|
auto f = result->getFriend();
|
||||||
auto friendsManager = FriendsManager::getInstance();
|
auto friendsManager = FriendsManager::getInstance();
|
||||||
if (f) {
|
if (f) {
|
||||||
qDebug() << "friend exists, append to unknown map";
|
qDebug() << "friend exists, append to unknown map";
|
||||||
auto friendAddress = f->getAddress()->clone();
|
auto friendAddress = f->getAddress() ? f->getAddress()->clone() : nullptr;
|
||||||
friendAddress->clean();
|
if (friendAddress) {
|
||||||
friendsManager->appendUnknownFriend(friendAddress, f);
|
friendAddress->clean();
|
||||||
if (friendsManager->isInOtherAddresses(Utils::coreStringToAppString(friendAddress->asStringUriOnly()))) {
|
friendsManager->appendUnknownFriend(friendAddress, f);
|
||||||
friendsManager->removeOtherAddress(Utils::coreStringToAppString(friendAddress->asStringUriOnly()));
|
if (friendsManager->isInOtherAddresses(
|
||||||
|
Utils::coreStringToAppString(friendAddress->asStringUriOnly()))) {
|
||||||
|
friendsManager->removeOtherAddress(Utils::coreStringToAppString(friendAddress->asStringUriOnly()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto fList = f ? f->getFriendList() : nullptr;
|
auto fList = f ? f->getFriendList() : nullptr;
|
||||||
|
|
@ -128,7 +132,7 @@ void MagicSearchModel::updateFriendListWithFriend(const std::shared_ptr<linphone
|
||||||
if (ToolModel::friendIsInFriendList(friendList, linphoneFriend))
|
if (ToolModel::friendIsInFriendList(friendList, linphoneFriend))
|
||||||
return; // Already exist. We don't need to manipulate list.
|
return; // Already exist. We don't need to manipulate list.
|
||||||
for (auto address : linphoneFriend->getAddresses()) {
|
for (auto address : linphoneFriend->getAddresses()) {
|
||||||
auto existingFriend = friendList->findFriendByAddress(address);
|
auto existingFriend = friendList ? friendList->findFriendByAddress(address) : nullptr;
|
||||||
if (existingFriend) {
|
if (existingFriend) {
|
||||||
friendList->removeFriend(existingFriend);
|
friendList->removeFriend(existingFriend);
|
||||||
friendList->addFriend(linphoneFriend);
|
friendList->addFriend(linphoneFriend);
|
||||||
|
|
@ -136,7 +140,7 @@ void MagicSearchModel::updateFriendListWithFriend(const std::shared_ptr<linphone
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto number : linphoneFriend->getPhoneNumbers()) {
|
for (auto number : linphoneFriend->getPhoneNumbers()) {
|
||||||
auto existingFriend = friendList->findFriendByPhoneNumber(number);
|
auto existingFriend = friendList ? friendList->findFriendByPhoneNumber(number) : nullptr;
|
||||||
if (existingFriend) {
|
if (existingFriend) {
|
||||||
friendList->removeFriend(existingFriend);
|
friendList->removeFriend(existingFriend);
|
||||||
friendList->addFriend(linphoneFriend);
|
friendList->addFriend(linphoneFriend);
|
||||||
|
|
@ -144,6 +148,6 @@ void MagicSearchModel::updateFriendListWithFriend(const std::shared_ptr<linphone
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qInfo() << log().arg("Adding Friend:") << linphoneFriend.get();
|
qInfo() << log().arg("Adding Friend:") << linphoneFriend.get();
|
||||||
friendList->addFriend(linphoneFriend);
|
if (friendList) friendList->addFriend(linphoneFriend);
|
||||||
emit CoreModel::getInstance()->friendCreated(linphoneFriend);
|
emit CoreModel::getInstance()->friendCreated(linphoneFriend);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "ToolModel.hpp"
|
#include "ToolModel.hpp"
|
||||||
#include "core/App.hpp"
|
#include "core/App.hpp"
|
||||||
|
#include "core/conference/ConferenceInfoCore.hpp"
|
||||||
#include "core/path/Paths.hpp"
|
#include "core/path/Paths.hpp"
|
||||||
#include "model/core/CoreModel.hpp"
|
#include "model/core/CoreModel.hpp"
|
||||||
#include "model/friend/FriendsManager.hpp"
|
#include "model/friend/FriendsManager.hpp"
|
||||||
|
|
@ -28,7 +29,6 @@
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
#include <QLibrary>
|
#include <QLibrary>
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
#include "core/conference/ConferenceInfoCore.hpp"
|
|
||||||
|
|
||||||
DEFINE_ABSTRACT_OBJECT(ToolModel)
|
DEFINE_ABSTRACT_OBJECT(ToolModel)
|
||||||
|
|
||||||
|
|
@ -379,6 +379,7 @@ std::shared_ptr<linphone::FriendList> ToolModel::getLdapFriendList() {
|
||||||
|
|
||||||
bool ToolModel::friendIsInFriendList(const std::shared_ptr<linphone::FriendList> &friendList,
|
bool ToolModel::friendIsInFriendList(const std::shared_ptr<linphone::FriendList> &friendList,
|
||||||
const std::shared_ptr<linphone::Friend> &f) {
|
const std::shared_ptr<linphone::Friend> &f) {
|
||||||
|
if (!friendList) return false;
|
||||||
auto friends = friendList->getFriends();
|
auto friends = friendList->getFriends();
|
||||||
auto it = std::find_if(friends.begin(), friends.end(),
|
auto it = std::find_if(friends.begin(), friends.end(),
|
||||||
[f](std::shared_ptr<linphone::Friend> linFriend) { return linFriend == f; });
|
[f](std::shared_ptr<linphone::Friend> linFriend) { return linFriend == f; });
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ ListView {
|
||||||
|
|
||||||
header: Item {
|
header: Item {
|
||||||
visible: mainItem.chat && mainItem.chat.core.isEncrypted
|
visible: mainItem.chat && mainItem.chat.core.isEncrypted
|
||||||
height: headerMessage.height + Math.round(50 * DefaultStyle.dp)
|
height: visible ? headerMessage.height + Math.round(50 * DefaultStyle.dp) : 0
|
||||||
width: headerMessage.width
|
width: headerMessage.width
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
Control.Control {
|
Control.Control {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue