summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2016-07-05 18:01:05 +0300
committerThiago Marcos P. Santos <thiago@mapbox.com>2016-07-05 21:04:27 +0300
commitdfd0b105cd0e45407f4df5e0e8c4f2d2739df83e (patch)
treef9f91feedde825cf11ec181684352b183909e17d
parent13cd75f099c92b6f0862db00eee8ff4a78a73316 (diff)
downloadqtlocation-mapboxgl-dfd0b105cd0e45407f4df5e0e8c4f2d2739df83e.tar.gz
[android] Fix issue when stop is called before run on the RunLoop
The current ::stop() implementation was not thread safe and we should queue the ::stop() for the next loop iteration so even if we call ::stop() before ::run(), it gets processed.
-rw-r--r--platform/android/src/run_loop.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/platform/android/src/run_loop.cpp b/platform/android/src/run_loop.cpp
index 1656565e8e..af85ab42df 100644
--- a/platform/android/src/run_loop.cpp
+++ b/platform/android/src/run_loop.cpp
@@ -211,8 +211,10 @@ void RunLoop::runOnce() {
}
void RunLoop::stop() {
- impl->running = false;
- impl->wake();
+ invoke([&] {
+ impl->running = false;
+ impl->wake();
+ });
}
void RunLoop::addWatch(int, Event, std::function<void(int, Event)>&&) {