Commit 7b2a5cce authored by Fabian Vogt's avatar Fabian Vogt
Browse files

SmtpJob: Fix use of KCompositeJob

SmtpJob overrides slotResult, but this had two issues. First, it connected
to LoginJob::result itself, though addJob already does that. Second, in two
cases it did not remove finished jobs from the list of subjobs, leading to
dangling pointers and messing up state. This was most likely only reached
in the case of an expired XOAUTH2 access_token and caused the job to fail
after a successful refresh.

BUG: 406839
BUG: 409122
BUG: 421664
BUG: 456923
parent 3748bf12
Pipeline #282597 skipped
......@@ -308,7 +308,6 @@ void SmtpJobPrivate::doLogin()
break;
}
q->connect(login, &KJob::result, q, &SmtpJob::slotResult);
q->addSubjob(login);
login->start();
qCDebug(MAILTRANSPORT_SMTP_LOG) << "Login started";
......@@ -352,11 +351,12 @@ bool SmtpJob::doKill()
void SmtpJob::slotResult(KJob *job)
{
if (s_sessionPool.isDestroyed()) {
removeSubjob(job);
return;
}
if (qobject_cast<KSmtp::LoginJob *>(job)) {
if (job->error() == KSmtp::LoginJob::TokenExpired) {
removeSubjob(job);
startPasswordRetrieval(/*force refresh */ true);
return;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment