mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
Fix crash on smartsearchbar : internal addresses weren't match to the number of count because of self result.
This commit is contained in:
parent
3824ecaa78
commit
effe5eb3aa
1 changed files with 7 additions and 13 deletions
|
|
@ -62,7 +62,7 @@ SearchSipAddressesModel::~SearchSipAddressesModel(){
|
|||
// -----------------------------------------------------------------------------
|
||||
|
||||
int SearchSipAddressesModel::rowCount (const QModelIndex &) const {
|
||||
return std::max(mAddresses.count()-1,0);
|
||||
return mAddresses.count();
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> SearchSipAddressesModel::roleNames () const {
|
||||
|
|
@ -118,16 +118,10 @@ void SearchSipAddressesModel::searchReceived(std::list<std::shared_ptr<linphone:
|
|||
if( linphoneFriend || address)
|
||||
addresses << std::make_shared<SearchResultModel>(linphoneFriend,address );
|
||||
}
|
||||
// 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();
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
beginResetModel();
|
||||
mAddresses.clear();
|
||||
mAddresses = addresses;
|
||||
if(mAddresses.size() > 0 )// remove self
|
||||
mAddresses.pop_back();
|
||||
endResetModel();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue