mail_daemon: IMAPConnectionWorker missing ::WorkerQuit() on errors

This fixes some crashes.

In _Worker thread on connect or process errors fOwner.WorkerQuit(this) was not called, leaving destroyed thread object in fWorkerMap and fWorkers.

Moreover, on connection problem the imap mailboxes was never checked on next planned sync because of non empty fWorkers.

Change-Id: I55ce6474b655fad5ddd8024225fc8f633bc35c48
Reviewed-on: https://review.haiku-os.org/678
Reviewed-by: Adrien Destugues <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Peter Kosyh
2018-11-08 14:26:03 +00:00
committed by waddlesplash
parent 2cf9765df8
commit 2e8be594e7
@@ -733,13 +733,16 @@ IMAPConnectionWorker::_Worker()
CommandDeleter deleter(*this, command);
status_t status = _Connect();
if (status != B_OK)
if (status != B_OK) {
fOwner.WorkerQuit(this);
return status;
}
status = command->Process(*this);
if (status != B_OK)
if (status != B_OK) {
fOwner.WorkerQuit(this);
return status;
}
if (!command->IsDone()) {
deleter.Detach();
command->SetContinuation();