1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-26 22:44:36 +00:00

Correctly handle model resetting

This commit is contained in:
Vladimir Golovnev (Glassez) 2022-11-10 13:32:48 +03:00
parent 0f82c16936
commit c636618cf3
No known key found for this signature in database
GPG Key ID: 52A2C7DEE2DFA6F7

View File

@ -519,7 +519,8 @@ void TorrentContentModel::setupModelData(const BitTorrent::AbstractFileStorage &
if (filesCount <= 0)
return;
emit layoutAboutToBeChanged();
beginResetModel();
// Initialize files_index array
qDebug("Torrent contains %d files", filesCount);
m_filesIndex.reserve(filesCount);
@ -566,5 +567,6 @@ void TorrentContentModel::setupModelData(const BitTorrent::AbstractFileStorage &
lastParent->appendChild(fileItem);
m_filesIndex.push_back(fileItem);
}
emit layoutChanged();
endResetModel();
}