From dd538539aae96f43fd4a1c31e643c5b18d059f8c Mon Sep 17 00:00:00 2001 From: Mike Gelfand Date: Tue, 2 May 2017 19:58:22 +0300 Subject: [PATCH] Fix torrent file trashing upon addition (Qt client) --- qt/Session.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/qt/Session.cc b/qt/Session.cc index fbf5dfbc5..bc47069ae 100644 --- a/qt/Session.cc +++ b/qt/Session.cc @@ -995,7 +995,7 @@ void Session::addTorrent(AddData const& addMe, tr_variant* args, bool trashOrigi d->show(); }); - q->add([this, addMe](RpcResponse const& r) + q->add([this, addMe, trashOriginal](RpcResponse const& r) { tr_variant* dup; char const* str; @@ -1010,17 +1010,13 @@ void Session::addTorrent(AddData const& addMe, tr_variant* args, bool trashOrigi connect(d, SIGNAL(rejected()), d, SLOT(deleteLater())); d->show(); } - }); - - if (trashOriginal && addMe.type == AddData::FILENAME) - { - q->add([this, addMe]() + else if (trashOriginal && addMe.type == AddData::FILENAME) { QFile original(addMe.filename); original.setPermissions(QFile::ReadOwner | QFile::WriteOwner); original.remove(); - }); - } + } + }); q->run(); } -- 2.49.0