aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2014-04-27 23:05:57 -0700
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2014-04-27 23:06:07 -0700
commite41ca9432453ca0848296ff18588016dbe294b48 (patch)
treeede85cae512bf3655d66f744b4eb1704beff82ce
parent4ab481f3448e5404669c2095ff2982ddbb9c669a (diff)
Fixed IMAP disconnect cancellation
-rw-r--r--src/async/imap/MCIMAPMultiDisconnectOperation.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/async/imap/MCIMAPMultiDisconnectOperation.cc b/src/async/imap/MCIMAPMultiDisconnectOperation.cc
index c33eb1bb..249df781 100644
--- a/src/async/imap/MCIMAPMultiDisconnectOperation.cc
+++ b/src/async/imap/MCIMAPMultiDisconnectOperation.cc
@@ -29,10 +29,13 @@ void IMAPMultiDisconnectOperation::addOperation(IMAPOperation * op)
void IMAPMultiDisconnectOperation::start()
{
if (_operations->count() == 0) {
- callback()->operationFinished(this);
+ if (callback() != NULL) {
+ callback()->operationFinished(this);
+ }
return;
}
+ retain();
mc_foreacharray(IMAPOperation, op, _operations) {
op->setCallbackDispatchQueue(this->callbackDispatchQueue());
op->setCallback(this);
@@ -44,7 +47,10 @@ void IMAPMultiDisconnectOperation::operationFinished(Operation * op)
{
_count ++;
if (_count == _operations->count()) {
- callback()->operationFinished(this);
+ if (callback() != NULL) {
+ callback()->operationFinished(this);
+ }
+ release();
}
}