From 4d058cfb768c10807359a1ffd2dbaf1eac589c1c Mon Sep 17 00:00:00 2001 From: wwylele Date: Tue, 22 Aug 2017 11:43:44 +0300 Subject: [PATCH] motion_emu: fix initialization order --- src/input_common/motion_emu.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/input_common/motion_emu.cpp b/src/input_common/motion_emu.cpp index a1761f1846..59a035e701 100644 --- a/src/input_common/motion_emu.cpp +++ b/src/input_common/motion_emu.cpp @@ -74,11 +74,14 @@ private: bool is_tilting = false; Common::Event shutdown_event; - std::thread motion_emu_thread; std::tuple, Math::Vec3> status; std::mutex status_mutex; + // Note: always keep the thread declaration at the end so that other objects are initialized + // before this! + std::thread motion_emu_thread; + void MotionEmuThread() { auto update_time = std::chrono::steady_clock::now(); Math::Quaternion q = MakeQuaternion(Math::Vec3(), 0);