summaryrefslogtreecommitdiff
path: root/platform/darwin
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2017-11-22 13:18:22 -0800
committerTobrun <tobrun@mapbox.com>2017-12-06 12:37:48 +0100
commit966b6a53cec1796e675e776fd421b6f1bdcf0acd (patch)
tree0facbf5f4323420238cfc566ff6eaa71cbc522da /platform/darwin
parent2a13bfd2c4c8d1575606d67321fb2354c754fa14 (diff)
downloadqtlocation-mapboxgl-966b6a53cec1796e675e776fd421b6f1bdcf0acd.tar.gz
[core, ios, qt, android] Close race condition in RunLoop (issue #9620)
Because a message we queue from the foreground may cause the background to complete, exit, and tear down the AsyncTask, we have to block queue processing until we've finished our call to AsyncTask::send(). Broadening the scope of a mutex is scary, but I audited the code of our four implementations of AsyncTask and I don't see any way this could cause a deadlock.
Diffstat (limited to 'platform/darwin')
-rw-r--r--platform/darwin/src/run_loop.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/platform/darwin/src/run_loop.cpp b/platform/darwin/src/run_loop.cpp
index 2ba8f8415b..d60a88cf52 100644
--- a/platform/darwin/src/run_loop.cpp
+++ b/platform/darwin/src/run_loop.cpp
@@ -30,8 +30,10 @@ RunLoop::~RunLoop() {
}
void RunLoop::push(std::shared_ptr<WorkTask> task) {
- withMutex([&] { queue.push(std::move(task)); });
- impl->async->send();
+ withMutex([&] {
+ queue.push(std::move(task));
+ impl->async->send();
+ });
}
void RunLoop::run() {