aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Hoa V. Dinh <dinh.viet.hoa@gmail.com>2015-01-14 11:53:21 -0800
committerGravatar Hoa V. Dinh <dinh.viet.hoa@gmail.com>2015-01-14 11:53:32 -0800
commitdfd76892dbab3b7fdc8dd6e12a2f262b1445a3bc (patch)
tree9ca7dec957fde2085dddfeacbb18362a2ce5723c
parentfd732714f7761114f44ed3bdcb50748afa7e02cc (diff)
Retain dispatch queue
-rw-r--r--src/core/basetypes/MCObject.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/basetypes/MCObject.cpp b/src/core/basetypes/MCObject.cpp
index 28fa3544..43137f78 100644
--- a/src/core/basetypes/MCObject.cpp
+++ b/src/core/basetypes/MCObject.cpp
@@ -310,13 +310,17 @@ void Object::performMethodOnMainThread(Method method, void * context, bool waitU
void Object::performMethodOnDispatchQueue(Method method, void * context, void * targetDispatchQueue, bool waitUntilDone)
{
if (waitUntilDone) {
+ dispatch_retain((dispatch_queue_t) targetDispatchQueue);
dispatch_sync((dispatch_queue_t) targetDispatchQueue, ^{
(this->*method)(context);
+ dispatch_release((dispatch_queue_t) targetDispatchQueue);
});
}
else {
+ dispatch_retain((dispatch_queue_t) targetDispatchQueue);
dispatch_async((dispatch_queue_t) targetDispatchQueue, ^{
(this->*method)(context);
+ dispatch_release((dispatch_queue_t) targetDispatchQueue);
});
}
}