mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-03 22:56:49 +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
92e483c855
commit
fc292bd788
1 changed files with 7 additions and 13 deletions
|
|
@ -62,7 +62,7 @@ SearchSipAddressesModel::~SearchSipAddressesModel(){
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
int SearchSipAddressesModel::rowCount (const QModelIndex &) const {
|
int SearchSipAddressesModel::rowCount (const QModelIndex &) const {
|
||||||
return std::max(mAddresses.count()-1,0);
|
return mAddresses.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<int, QByteArray> SearchSipAddressesModel::roleNames () const {
|
QHash<int, QByteArray> SearchSipAddressesModel::roleNames () const {
|
||||||
|
|
@ -118,16 +118,10 @@ void SearchSipAddressesModel::searchReceived(std::list<std::shared_ptr<linphone:
|
||||||
if( linphoneFriend || address)
|
if( linphoneFriend || address)
|
||||||
addresses << std::make_shared<SearchResultModel>(linphoneFriend,address );
|
addresses << std::make_shared<SearchResultModel>(linphoneFriend,address );
|
||||||
}
|
}
|
||||||
// Fix crash on Qt 5.15.2 with endResetModel (index out of range).
|
beginResetModel();
|
||||||
if(mAddresses.size() > 0){// Workaround : remove all
|
|
||||||
beginRemoveRows(QModelIndex(), 0, mAddresses.size()-1);
|
|
||||||
mAddresses.clear();
|
mAddresses.clear();
|
||||||
endRemoveRows();
|
|
||||||
}
|
|
||||||
if( addresses.size() > 0){// Workaround : add new on cleanned base
|
|
||||||
beginInsertRows(QModelIndex(),0, addresses.size()-1);
|
|
||||||
mAddresses = addresses;
|
mAddresses = addresses;
|
||||||
endInsertRows();
|
if(mAddresses.size() > 0 )// remove self
|
||||||
}
|
mAddresses.pop_back();
|
||||||
//--------------------------------------------------------------
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue