From 8b19aefed45c48a00c81b2504a07ee5f88f6364a Mon Sep 17 00:00:00 2001 From: "Hoa V. Dinh" Date: Thu, 25 Jul 2013 23:00:54 -0700 Subject: Fixed cancellation of POPOperation --- src/async/pop/MCPOPOperation.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/async') 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(); } -- cgit v1.2.3