aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2015-01-15 15:52:23 -0800
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2015-01-15 15:52:23 -0800
commit60f825b5cc92bbfffe1f27f960b9f9d7d226547e (patch)
tree6ebaa0b4cfed8d527faea8a68eaafb41828742ab
parent503c657d31937606b00fc8dd049d78667ab4cee2 (diff)
Retain dispatch queue when using dispatch_sync()
-rw-r--r--src/core/basetypes/MCObject.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/basetypes/MCObject.cpp b/src/core/basetypes/MCObject.cpp
index 28fa3544..3034c791 100644
--- a/src/core/basetypes/MCObject.cpp
+++ b/src/core/basetypes/MCObject.cpp
@@ -310,9 +310,11 @@ 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_async((dispatch_queue_t) targetDispatchQueue, ^{