Commit 5f9902c1 authored by Jonathan Marten's avatar Jonathan Marten

Fix POP3 mail fetch not finishing if there are no new messages but some old ones

This may have been introduced by commit e7ba619b.
It happens when there are no new messages to download, detected
in doStateStep() in the Download state.  The state then changes
to CheckRemovingMessage and checkRemovingMessageFromServer() starts
a delete job if there are any old messages to be deleted.  When the
delete job finishes, deleteJobResult() is called which checks
shouldAdvanceToQuitState() to see whether there is any more work to
do... but the first conditional in shouldAdvanceToQuitState() is
"mState==Save".  This condition can never be satisfied once the
state has become CheckRemovingMessage.

The solution is, at the end of deleteJobResult(), to go to state Save
if there are no more deletion jobs to run.  If there are, the state will
remain as CheckRemovingMessage and the same check will be done when the
deletion job eventually finishes.

Differential Revision: https://phabricator.kde.org/D9013
parent 2a5b4df5
......@@ -421,6 +421,7 @@ void POP3Resource::doStateStep()
}
break;
case CheckRemovingMessage:
qCDebug(POP3RESOURCE_LOG) << "================ Starting state CheckRemovingMessage ===================";
checkRemovingMessageFromServer();
break;
}
......@@ -837,6 +838,9 @@ void POP3Resource::deleteJobResult(KJob *job)
if (shouldAdvanceToQuitState()) {
advanceState(Quit);
}
else if (mDeleteJob == nullptr) {
advanceState(Save);
}
}
void POP3Resource::finish()
......
Markdown is supported
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