From bffc60fefda049c8cde0843988c2b73ab87b6103 Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Tue, 17 Jul 2018 14:20:08 +0300 Subject: [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. --- platform/android/src/run_loop.cpp | 1 + 1 file changed, 1 insertion(+) 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 lock(mtx); runnable->iter = runnables.end(); } -- cgit v1.2.1