From aa19f07ccf6b21737904b6e96b30eff69edb1fd7 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Sat, 2 May 2015 12:57:25 -0400 Subject: [PATCH] RunLoop must outlive Object ~Object is likely to join threads that want to dispatch results back to this RunLoop. This happens, for example, when MapContext is destructed: it joins the worker threads, which need to complete work before shutting down. --- src/mbgl/util/thread.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mbgl/util/thread.hpp b/src/mbgl/util/thread.hpp index 0d46d12b7..55c3d4d28 100644 --- a/src/mbgl/util/thread.hpp +++ b/src/mbgl/util/thread.hpp @@ -122,12 +122,12 @@ void Thread::run(P&& params, index_sequence) { uv::loop l; { - Object object_(l.get(), std::get(std::forward

(params))...); - object = &object_; - RunLoop loop_(l.get()); loop = &loop_; + Object object_(l.get(), std::get(std::forward

(params))...); + object = &object_; + running.set_value(); l.run();