mirror of
https://github.com/transmission/transmission
synced 2025-02-24 23:12:35 +00:00
Revert dd538539aa
, fix RPC queue processing
Queue callback for items returning no new future was never called leaving queue alive and leading to memory leak in Qt client.
This commit is contained in:
parent
580c5e4166
commit
375f2642c8
2 changed files with 27 additions and 7 deletions
|
@ -72,9 +72,25 @@ void RpcQueue::runNext(RpcResponseFuture const& response)
|
|||
{
|
||||
assert(!myQueue.isEmpty());
|
||||
|
||||
auto next = myQueue.dequeue();
|
||||
myNextErrorHandler = next.second;
|
||||
myFutureWatcher.setFuture((next.first)(response));
|
||||
RpcResponseFuture const oldFuture = myFutureWatcher.future();
|
||||
|
||||
while (true)
|
||||
{
|
||||
auto next = myQueue.dequeue();
|
||||
myNextErrorHandler = next.second;
|
||||
myFutureWatcher.setFuture((next.first)(response));
|
||||
|
||||
if (oldFuture != myFutureWatcher.future())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (myQueue.isEmpty())
|
||||
{
|
||||
deleteLater();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RpcQueue::run()
|
||||
|
|
|
@ -995,7 +995,7 @@ void Session::addTorrent(AddData const& addMe, tr_variant* args, bool trashOrigi
|
|||
d->show();
|
||||
});
|
||||
|
||||
q->add([this, addMe, trashOriginal](RpcResponse const& r)
|
||||
q->add([this, addMe](RpcResponse const& r)
|
||||
{
|
||||
tr_variant* dup;
|
||||
char const* str;
|
||||
|
@ -1010,13 +1010,17 @@ void Session::addTorrent(AddData const& addMe, tr_variant* args, bool trashOrigi
|
|||
connect(d, SIGNAL(rejected()), d, SLOT(deleteLater()));
|
||||
d->show();
|
||||
}
|
||||
else if (trashOriginal && addMe.type == AddData::FILENAME)
|
||||
});
|
||||
|
||||
if (trashOriginal && addMe.type == AddData::FILENAME)
|
||||
{
|
||||
q->add([this, addMe]()
|
||||
{
|
||||
QFile original(addMe.filename);
|
||||
original.setPermissions(QFile::ReadOwner | QFile::WriteOwner);
|
||||
original.remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
q->run();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue