From c636618cf3e7607f4465dc7b7b0909a087827f6c Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (Glassez)" Date: Thu, 10 Nov 2022 13:32:48 +0300 Subject: [PATCH] Correctly handle model resetting --- src/gui/torrentcontentmodel.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/torrentcontentmodel.cpp b/src/gui/torrentcontentmodel.cpp index 58d8c7b16..9357fdc8e 100644 --- a/src/gui/torrentcontentmodel.cpp +++ b/src/gui/torrentcontentmodel.cpp @@ -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(); }