diff options
author | Hoa V. Dinh <dinh.viet.hoa@gmail.com> | 2013-07-25 23:01:09 -0700 |
---|---|---|
committer | Hoa V. Dinh <dinh.viet.hoa@gmail.com> | 2013-07-25 23:01:09 -0700 |
commit | b27f76a56eebe7e297e9f7c2f00bf3b0eb61d662 (patch) | |
tree | f5b5f2774945690a03c45eda782aa60047add9e1 /src/async/smtp | |
parent | 8b19aefed45c48a00c81b2504a07ee5f88f6364a (diff) |
Fixed cancellation of SMTPOperation
Diffstat (limited to 'src/async/smtp')
-rw-r--r-- | src/async/smtp/MCSMTPOperation.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/async/smtp/MCSMTPOperation.cc b/src/async/smtp/MCSMTPOperation.cc index e8211a24..0661ce9f 100644 --- a/src/async/smtp/MCSMTPOperation.cc +++ b/src/async/smtp/MCSMTPOperation.cc @@ -71,14 +71,22 @@ void SMTPOperation::bodyProgress(SMTPSession * session, unsigned int current, un struct progressContext * context = (struct progressContext *) calloc(sizeof(* context), 1); context->current = current; context->maximum = maximum; + + retain(); performMethodOnMainThread((Object::Method) &SMTPOperation::bodyProgressOnMainThread, context); } void SMTPOperation::bodyProgressOnMainThread(void * ctx) { + if (isCancelled()) { + release(); + return; + } + struct progressContext * context = (struct progressContext *) ctx; if (mSmtpCallback != NULL) { mSmtpCallback->bodyProgress(this, context->current, context->maximum); } free(context); + release(); } |