diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-06-05 07:40:01 +0200 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-06-05 07:40:01 +0200 |
commit | 79ede9bcb6d4fc5e269f506b2a10bfe4c302040a (patch) | |
tree | 8b162c198c1ae7c16693f90cfccd50e6d93d07cb /lib/connection.cpp | |
parent | 1973d7d53d80ced1eabc61aa0d42e1d4d7995c85 (diff) | |
download | libquotient-79ede9bcb6d4fc5e269f506b2a10bfe4c302040a.tar.gz libquotient-79ede9bcb6d4fc5e269f506b2a10bfe4c302040a.zip |
Connection::run(): Q_INVOKABLE and chaining
Diffstat (limited to 'lib/connection.cpp')
-rw-r--r-- | lib/connection.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp index efc7163e..f497601e 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -1622,11 +1622,14 @@ void Connection::setLazyLoading(bool newValue) } } -void Connection::run(BaseJob* job, RunningPolicy runningPolicy) +BaseJob* Connection::run(BaseJob* job, RunningPolicy runningPolicy) { - job->setParent(this); // Protects from #397, #398 + // Reparent to protect from #397, #398 and to prevent BaseJob* from being + // garbage-collected if made by or returned to QML/JavaScript. + job->setParent(this); connect(job, &BaseJob::failure, this, &Connection::requestFailed); job->initiate(d->data.get(), runningPolicy & BackgroundRequest); + return job; } void Connection::getTurnServers() |