From dfd0b105cd0e45407f4df5e0e8c4f2d2739df83e Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Tue, 5 Jul 2016 18:01:05 +0300 Subject: [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. --- platform/android/src/run_loop.cpp | 6 ++++-- 1 file 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&&) { -- cgit v1.2.1