diff options
author | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2018-07-17 14:20:08 +0300 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2018-07-17 18:36:37 +0200 |
commit | bffc60fefda049c8cde0843988c2b73ab87b6103 (patch) | |
tree | 05ff12ea6424cc8bf3b617e5d7e6f3efc233ef15 | |
parent | 93d37282d9d7f4050a7fc682de8abea01996f113 (diff) | |
download | qtlocation-mapboxgl-bffc60fefda049c8cde0843988c2b73ab87b6103.tar.gz |
[android] Fix possibly race on undefined behavior
`runnable->iter = runnables.end()` assumes that `::end()` is a
`static` or `constxpr` and thread-safe. This is likely to be true
for most of the implementations. That said we cannot rely on
undefined behavior and we should assume the worse case scenario.
-rw-r--r-- | platform/android/src/run_loop.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/platform/android/src/run_loop.cpp b/platform/android/src/run_loop.cpp index f655f13ea8..b55f2be190 100644 --- a/platform/android/src/run_loop.cpp +++ b/platform/android/src/run_loop.cpp @@ -167,6 +167,7 @@ void RunLoop::Impl::removeRunnable(Runnable* runnable) { } void RunLoop::Impl::initRunnable(Runnable* runnable) { + std::lock_guard<std::recursive_mutex> lock(mtx); runnable->iter = runnables.end(); } |