diff options
author | Viet Hoa Dinh <dvh@fb.com> | 2018-12-13 23:44:59 -0800 |
---|---|---|
committer | Viet Hoa Dinh <dvh@fb.com> | 2018-12-13 23:44:59 -0800 |
commit | a452b2cfecc803ee08c513a037999384a50555d9 (patch) | |
tree | 4d390f99f10b5fff8715f20a710af3f5a6949502 | |
parent | 1e889f7e441d8540bc55c131b891a338199ad207 (diff) |
Fixed memory leak
-rw-r--r-- | src/core/basetypes/MCObject.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/basetypes/MCObject.cpp b/src/core/basetypes/MCObject.cpp index c9d8d464..65f67588 100644 --- a/src/core/basetypes/MCObject.cpp +++ b/src/core/basetypes/MCObject.cpp @@ -341,8 +341,10 @@ void Object::performMethodOnDispatchQueueAfterDelay(Method method, void * contex initDelayedPerform(); __block bool cancelled = false; - + + void (^dupCancelableBlock)(bool cancel) = NULL; void (^cancelableBlock)(bool cancel) = ^(bool cancel) { + Block_release(dupCancelableBlock); if (cancel) { cancelled = true; return; @@ -352,7 +354,7 @@ void Object::performMethodOnDispatchQueueAfterDelay(Method method, void * contex } }; - void (^dupCancelableBlock)(bool cancel) = Block_copy(cancelableBlock); + dupCancelableBlock = Block_copy(cancelableBlock); retain(); addToPerformHash(this, method, context, targetDispatchQueue, (void *) dupCancelableBlock); |