mail: IMAP fix deadlock when connection failed

fLocker must be released in IMAPConnectionWorker::_Worker() before WorkerQuit() call.

Change-Id: I1e622a711fa3349986560af1118b158696025844
Reviewed-on: https://review.haiku-os.org/705
Reviewed-by: Axel Dörfler <[email protected]>
This commit is contained in:
Peter Kosyh
2018-11-17 16:26:35 +00:00
committed by Axel Dörfler
parent a4ba432352
commit a6a1266240
@@ -717,6 +717,8 @@ IMAPConnectionWorker::MessageExpungeReceived(uint32 index)
status_t
IMAPConnectionWorker::_Worker()
{
status_t status = B_OK;
while (!fStopped) {
BAutolock locker(fLocker);
@@ -736,21 +738,16 @@ IMAPConnectionWorker::_Worker()
CommandDeleter deleter(*this, command);
status_t status = B_OK;
if (dynamic_cast<QuitCommand*>(command) == NULL) // do not connect on QuitCommand
if (dynamic_cast<QuitCommand*>(command) == NULL) { // do not connect on QuitCommand
status = _Connect();
if (status != B_OK) {
fOwner.WorkerQuit(this);
return status;
if (status != B_OK)
break;
}
status = command->Process(*this);
if (status != B_OK) {
fOwner.WorkerQuit(this);
return status;
}
if (status != B_OK)
break;
if (!command->IsDone()) {
deleter.Detach();
command->SetContinuation();
@@ -759,7 +756,7 @@ IMAPConnectionWorker::_Worker()
}
fOwner.WorkerQuit(this);
return B_OK;
return status;
}