aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2020-03-30 19:41:59 +0200
committerKitsune Ral <Kitsune-Ral@users.sf.net>2020-03-30 19:41:59 +0200
commit08cc50a3e6699e4d0cff60108260adbd8cbdf419 (patch)
treee304a056749521fb1d609d6cf6dc6ac015eb6b22
parentcfbc71bc70707ff1ed691cc04ecbe246024f6734 (diff)
downloadlibquotient-08cc50a3e6699e4d0cff60108260adbd8cbdf419.tar.gz
libquotient-08cc50a3e6699e4d0cff60108260adbd8cbdf419.zip
Connection::resolveServer(): reparent jobs to ensure proper clean-away
This is a spot fix for #398; Quotient 0.6 will reparent all jobs to make sure they are removed after the connection is gone (this also partially helps with #397).
-rw-r--r--lib/connection.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index cc140ae4..0c98c383 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -185,6 +185,10 @@ void Connection::resolveServer(const QString& mxidOrDomain)
d->data->setBaseUrl(maybeBaseUrl); // Just enough to check .well-known file
auto getWellKnownJob = callApi<GetWellknownJob>();
+ // This is a workaround for 0.5.x; due to the way Quaternion's login dialog
+ // operates, Connection can disappear any moment during server resolution.
+ // Quotient 0.6 will reparent all jobs to enforce lifetimes. See also #398.
+ getWellKnownJob->setParent(this);
connect(getWellKnownJob, &BaseJob::finished, this,
[this, getWellKnownJob, maybeBaseUrl] {
if (getWellKnownJob->status() != BaseJob::NotFoundError) {
@@ -216,6 +220,7 @@ void Connection::resolveServer(const QString& mxidOrDomain)
}
auto getVersionsJob = callApi<GetVersionsJob>();
+ getVersionsJob->setParent(this); // Same workaround as above
connect(getVersionsJob, &BaseJob::success, this,
&Connection::resolved);
connect(getVersionsJob, &BaseJob::failure, this, [this] {