mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-25 15:48:34 +00:00
Fix a multithreaded crash when searching with MagicSearch
This commit is contained in:
parent
21303fc0d6
commit
9cb8df0b2d
1 changed files with 5 additions and 4 deletions
|
|
@ -50,7 +50,7 @@ SearchSipAddressesModel::SearchSipAddressesModel (QObject *parent) : QAbstractLi
|
|||
|
||||
mMagicSearch = CoreManager::getInstance()->getCore()->createMagicSearch();
|
||||
mSearch = std::make_shared<SearchHandler>(this);
|
||||
QObject::connect(mSearch.get(), SIGNAL(searchReceived(std::list<std::shared_ptr<linphone::SearchResult>> )), this, SLOT(searchReceived(std::list<std::shared_ptr<linphone::SearchResult>>)));
|
||||
QObject::connect(mSearch.get(), &SearchHandler::searchReceived, this, &SearchSipAddressesModel::searchReceived, Qt::QueuedConnection);
|
||||
mMagicSearch->addListener(mSearch);
|
||||
|
||||
}
|
||||
|
|
@ -111,9 +111,10 @@ void SearchSipAddressesModel::setFilter(const QString& filter){
|
|||
}
|
||||
|
||||
void SearchSipAddressesModel::searchReceived(std::list<std::shared_ptr<linphone::SearchResult>> results){
|
||||
beginResetModel();
|
||||
mAddresses.clear();
|
||||
QList<std::shared_ptr<SearchResultModel> > addresses;
|
||||
for(auto it = results.begin() ; it != results.end() ; ++it)
|
||||
mAddresses << std::make_shared<SearchResultModel>((*it)->getFriend(), (*it)->getAddress());
|
||||
addresses << std::make_shared<SearchResultModel>((*it)->getFriend(), (*it)->getAddress());
|
||||
beginResetModel();
|
||||
mAddresses = addresses;
|
||||
endResetModel();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue