mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-31 20:58:07 -06:00
Fix .torrent file could not be deleted when torrent is canceled
PR #21735. Closes #21723.
This commit is contained in:
committed by
GitHub
parent
08b51fc869
commit
0f18e80154
@@ -235,15 +235,22 @@ bool GUIAddTorrentManager::processTorrent(const QString &source
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
m_dialogs[infoHash] = dlg;
|
||||
connect(dlg, &AddNewTorrentDialog::torrentAccepted, this
|
||||
, [this, source](const BitTorrent::TorrentDescriptor &torrentDescr, const BitTorrent::AddTorrentParams &addTorrentParams)
|
||||
{
|
||||
addTorrentToSession(source, torrentDescr, addTorrentParams);
|
||||
});
|
||||
connect(dlg, &QDialog::finished, this, [this, source, infoHash, dlg]
|
||||
, [this, source, dlg](const BitTorrent::TorrentDescriptor &torrentDescr, const BitTorrent::AddTorrentParams &addTorrentParams)
|
||||
{
|
||||
if (dlg->isDoNotDeleteTorrentChecked())
|
||||
releaseTorrentFileGuard(source);
|
||||
{
|
||||
if (auto torrentFileGuard = releaseTorrentFileGuard(source))
|
||||
torrentFileGuard->setAutoRemove(false);
|
||||
}
|
||||
|
||||
addTorrentToSession(source, torrentDescr, addTorrentParams);
|
||||
});
|
||||
connect(dlg, &AddNewTorrentDialog::torrentRejected, this, [this, source]
|
||||
{
|
||||
releaseTorrentFileGuard(source);
|
||||
});
|
||||
connect(dlg, &QDialog::finished, this, [this, source, infoHash]
|
||||
{
|
||||
m_dialogs.remove(infoHash);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user