mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
Fix crash on endResetModel while searching a sip address (spotted on Qt 5.15.2).
This commit is contained in:
parent
e7fa1f219e
commit
cbc9c6f0cc
2 changed files with 16 additions and 5 deletions
|
|
@ -114,7 +114,16 @@ void SearchSipAddressesModel::searchReceived(std::list<std::shared_ptr<linphone:
|
|||
QList<std::shared_ptr<SearchResultModel> > addresses;
|
||||
for(auto it = results.begin() ; it != results.end() ; ++it)
|
||||
addresses << std::make_shared<SearchResultModel>((*it)->getFriend(), (*it)->getAddress());
|
||||
beginResetModel();
|
||||
mAddresses = addresses;
|
||||
endResetModel();
|
||||
// Fix crash on Qt 5.15.2 with endResetModel (index out of range).
|
||||
if(mAddresses.size() > 0){// Workaround : remove all
|
||||
beginRemoveRows(QModelIndex(), 0, mAddresses.size()-1);
|
||||
mAddresses.clear();
|
||||
endRemoveRows();
|
||||
}
|
||||
if( addresses.size() > 0){// Workaround : add new on cleanned base
|
||||
beginInsertRows(QModelIndex(),0, addresses.size()-1);
|
||||
mAddresses = addresses;
|
||||
endInsertRows();
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,8 +73,10 @@ bool SearchSipAddressesProxyModel::isIgnored(const QString& address) const{
|
|||
bool SearchSipAddressesProxyModel::filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const {
|
||||
const QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||
const SearchResultModel * model = sourceModel()->data(index).value<SearchResultModel*>();
|
||||
|
||||
return !mResultsToIgnore.contains(Utils::coreStringToAppString(model->getAddress()->asStringUriOnly()));
|
||||
if(!model)
|
||||
return false;
|
||||
else
|
||||
return !mResultsToIgnore.contains(Utils::coreStringToAppString(model->getAddress()->asStringUriOnly()));
|
||||
}
|
||||
|
||||
bool SearchSipAddressesProxyModel::lessThan (const QModelIndex &left, const QModelIndex &right) const {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue