diff options
author | Hoa V. Dinh <dinh.viet.hoa@gmail.com> | 2013-07-25 23:00:54 -0700 |
---|---|---|
committer | Hoa V. Dinh <dinh.viet.hoa@gmail.com> | 2013-07-25 23:00:54 -0700 |
commit | 8b19aefed45c48a00c81b2504a07ee5f88f6364a (patch) | |
tree | 9a0ca51a033cd3cec5ee014e2a398eecc9e3aa76 /src/async/pop | |
parent | a2013b0a10771637f5a3d7beaf67bb6ea1d0bf9a (diff) |
Fixed cancellation of POPOperation
Diffstat (limited to 'src/async/pop')
-rw-r--r-- | src/async/pop/MCPOPOperation.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/async/pop/MCPOPOperation.cc b/src/async/pop/MCPOPOperation.cc index 7fb279d6..76ecdb82 100644 --- a/src/async/pop/MCPOPOperation.cc +++ b/src/async/pop/MCPOPOperation.cc @@ -73,14 +73,22 @@ void POPOperation::bodyProgress(POPSession * session, unsigned int current, unsi struct progressContext * context = (struct progressContext *) calloc(sizeof(* context), 1); context->current = current; context->maximum = maximum; + + retain(); performMethodOnMainThread((Object::Method) &POPOperation::bodyProgressOnMainThread, context); } void POPOperation::bodyProgressOnMainThread(void * ctx) { + if (isCancelled()) { + release(); + return; + } + struct progressContext * context = (struct progressContext *) ctx; if (mPopCallback != NULL) { mPopCallback->bodyProgress(this, context->current, context->maximum); } free(context); + release(); } |