aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-02-27 11:21:08 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-02-27 11:21:08 +0900
commit39d44789d0f378b29d2c15994e8fa630edcdb408 (patch)
tree20100f1bb8c204648f4ff82dfe66f22046472d24
parente0a0542a812937b189f2adc7da9f2c9bba2d89b1 (diff)
downloadlibquotient-39d44789d0f378b29d2c15994e8fa630edcdb408.tar.gz
libquotient-39d44789d0f378b29d2c15994e8fa630edcdb408.zip
BaseJob::abandon() fixes
1. It should work with non-started jobs now (Closes #289). 2. It should allow clients to still handle `finished()` instead of cutting them off right before emitting the signal.
-rw-r--r--lib/jobs/basejob.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/jobs/basejob.cpp b/lib/jobs/basejob.cpp
index 628d10ec..8c3381ae 100644
--- a/lib/jobs/basejob.cpp
+++ b/lib/jobs/basejob.cpp
@@ -603,7 +603,7 @@ void BaseJob::setStatus(Status s)
if (d->status == s)
return;
- if (!d->connection->accessToken().isEmpty())
+ if (d->connection && !d->connection->accessToken().isEmpty())
s.message.replace(d->connection->accessToken(), "(REDACTED)");
if (!s.good())
qCWarning(d->logCat) << this << "status" << s;
@@ -618,9 +618,8 @@ void BaseJob::setStatus(int code, QString message)
void BaseJob::abandon()
{
- beforeAbandon(d->reply.data());
+ beforeAbandon(d->reply ? d->reply.data() : nullptr);
setStatus(Abandoned);
- this->disconnect();
if (d->reply)
d->reply->disconnect(this);
emit finished(this);