mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
mobile/models: correctly reset the connection model
Qt hates empty ranges, and even for a non-empty range, this is better implemented as a reset than a remove. This fixes a crash that I have been able to create on iOS by rescanning for devices on the download page. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1fd8ea9d49
commit
b241d09694
1 changed files with 5 additions and 2 deletions
|
@ -39,9 +39,12 @@ void ConnectionListModel::addAddress(const QString &address)
|
|||
|
||||
void ConnectionListModel::removeAllAddresses()
|
||||
{
|
||||
beginRemoveRows(QModelIndex(), 0, rowCount());
|
||||
if (rowCount() == 0)
|
||||
return;
|
||||
|
||||
beginResetModel();
|
||||
m_addresses.clear();
|
||||
endRemoveRows();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
int ConnectionListModel::indexOf(const QString &address) const
|
||||
|
|
Loading…
Reference in a new issue