diff --git a/src/gui/transferlistmodel.cpp b/src/gui/transferlistmodel.cpp index a1a372e30..14c8c4cb8 100644 --- a/src/gui/transferlistmodel.cpp +++ b/src/gui/transferlistmodel.cpp @@ -632,9 +632,12 @@ bool TransferListModel::setData(const QModelIndex &index, const QVariant &value, void TransferListModel::addTorrents(const QVector &torrents) { - int row = m_torrentList.size(); - beginInsertRows({}, row, (row + torrents.size())); + qsizetype row = m_torrentList.size(); + const qsizetype total = row + torrents.size(); + beginInsertRows({}, row, total); + + m_torrentList.reserve(total); for (BitTorrent::Torrent *torrent : torrents) { Q_ASSERT(!m_torrentMap.contains(torrent));