소스 검색

Merge pull request #2894 from wwylele/motion-emu-fix

motion_emu: fix initialization order
bunnei 9 년 전
부모
커밋
03c782e378
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      src/input_common/motion_emu.cpp

+ 4 - 1
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<float>, Math::Vec3<float>> 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<float> q = MakeQuaternion(Math::Vec3<float>(), 0);