aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objc/smtp
diff options
context:
space:
mode:
authorGravatar Hoa V. Dinh <dinh.viet.hoa@gmail.com>2013-06-28 09:58:19 -0700
committerGravatar Hoa V. Dinh <dinh.viet.hoa@gmail.com>2013-06-28 09:58:19 -0700
commitde51dd02d4c16d5c6bc89a2fe0e49ffda79f2a33 (patch)
tree3e0c9bc200fa096f37184746c65ab917459f656c /src/objc/smtp
parent29bc4a2eac587c83f1de1ecf5ee5dc2299452966 (diff)
Fixed memory leak: operations were retained by the block they owned, which created a cycle reference.
Diffstat (limited to 'src/objc/smtp')
-rw-r--r--src/objc/smtp/MCOSMTPOperation.mm2
-rw-r--r--src/objc/smtp/MCOSMTPSendOperation.mm12
2 files changed, 2 insertions, 12 deletions
diff --git a/src/objc/smtp/MCOSMTPOperation.mm b/src/objc/smtp/MCOSMTPOperation.mm
index cd52ad13..9d96613f 100644
--- a/src/objc/smtp/MCOSMTPOperation.mm
+++ b/src/objc/smtp/MCOSMTPOperation.mm
@@ -41,6 +41,8 @@ typedef void (^CompletionType)(NSError *error);
NSError * error = [NSError mco_errorWithErrorCode:MCO_NATIVE_INSTANCE->error()];
_completionBlock(error);
+ [_completionBlock release];
+ _completionBlock = NULL;
}
- (void) setSession:(MCOSMTPSession *)session
diff --git a/src/objc/smtp/MCOSMTPSendOperation.mm b/src/objc/smtp/MCOSMTPSendOperation.mm
index e41a9f5a..776f7270 100644
--- a/src/objc/smtp/MCOSMTPSendOperation.mm
+++ b/src/objc/smtp/MCOSMTPSendOperation.mm
@@ -80,18 +80,6 @@ private:
[self start];
}
-- (void)operationCompleted {
- if (_completionBlock == NULL)
- return;
-
- nativeType *op = MCO_NATIVE_INSTANCE;
- if (op->error() == mailcore::ErrorNone) {
- _completionBlock(nil);
- } else {
- _completionBlock([NSError mco_errorWithErrorCode:op->error()]);
- }
-}
-
- (void) bodyProgress:(unsigned int)current maximum:(unsigned int)maximum
{
if (_progress != NULL) {