mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 13:18:06 -06:00
Merge pull request #2140 from sorokin/fix-torrent-removal
Fix torrent removal. Closes #2132
This commit is contained in:
@@ -331,7 +331,6 @@ void TorrentModel::populate() {
|
||||
// Listen for torrent changes
|
||||
connect(QBtSession::instance(), SIGNAL(addedTorrent(QTorrentHandle)), SLOT(addTorrent(QTorrentHandle)));
|
||||
connect(QBtSession::instance(), SIGNAL(torrentAboutToBeRemoved(QTorrentHandle)), SLOT(handleTorrentAboutToBeRemoved(QTorrentHandle)));
|
||||
connect(QBtSession::instance(), SIGNAL(deletedTorrent(QString)), SLOT(removeTorrent(QString)));
|
||||
connect(QBtSession::instance(), SIGNAL(finishedTorrent(QTorrentHandle)), SLOT(handleFinishedTorrent(QTorrentHandle)));
|
||||
connect(QBtSession::instance(), SIGNAL(metadataReceived(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle)));
|
||||
connect(QBtSession::instance(), SIGNAL(resumedTorrent(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle)));
|
||||
@@ -440,18 +439,6 @@ void TorrentModel::addTorrent(const QTorrentHandle &h)
|
||||
}
|
||||
}
|
||||
|
||||
void TorrentModel::removeTorrent(const QString &hash)
|
||||
{
|
||||
const int row = torrentRow(hash);
|
||||
qDebug() << Q_FUNC_INFO << hash << row;
|
||||
if (row >= 0) {
|
||||
beginRemoveTorrent(row);
|
||||
delete m_torrents[row];
|
||||
m_torrents.removeAt(row);
|
||||
endRemoveTorrent();
|
||||
}
|
||||
}
|
||||
|
||||
void TorrentModel::beginInsertTorrent(int row)
|
||||
{
|
||||
beginInsertRows(QModelIndex(), row, row);
|
||||
@@ -578,8 +565,14 @@ QString TorrentModel::torrentHash(int row) const
|
||||
void TorrentModel::handleTorrentAboutToBeRemoved(const QTorrentHandle &h)
|
||||
{
|
||||
const int row = torrentRow(h.hash());
|
||||
qDebug() << Q_FUNC_INFO << row;
|
||||
if (row >= 0) {
|
||||
emit torrentAboutToBeRemoved(m_torrents.at(row));
|
||||
|
||||
beginRemoveTorrent(row);
|
||||
delete m_torrents[row];
|
||||
m_torrents.removeAt(row);
|
||||
endRemoveTorrent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user