From 8643bfc9774b58be0c05ea5fed073c26de4e29a1 Mon Sep 17 00:00:00 2001 From: Arjun Balgovind <32061677+arjunbalgovind@users.noreply.github.com> Date: Fri, 9 Oct 2020 16:13:48 -0700 Subject: [PATCH] Change declaration order of delay thread member in KeyDelay (#7206) --- src/modules/keyboardmanager/common/KeyDelay.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/keyboardmanager/common/KeyDelay.h b/src/modules/keyboardmanager/common/KeyDelay.h index e76de2e29c..5c59a180dc 100644 --- a/src/modules/keyboardmanager/common/KeyDelay.h +++ b/src/modules/keyboardmanager/common/KeyDelay.h @@ -63,7 +63,6 @@ private: // Also checks for overflow conditions. bool CheckIfMillisHaveElapsed(DWORD64 first, DWORD64 last, DWORD64 duration); - std::thread _delayThread; bool _quit; KeyDelayState _state; @@ -86,6 +85,9 @@ private: // Virtual Key provided in the constructor. Passed to callback functions. DWORD _key; + // Declare _delayThread after all other members so that it is the last to be initialized by the constructor + std::thread _delayThread; + static const DWORD64 LONG_PRESS_DELAY_MILLIS = 900; static const DWORD64 ON_HOLD_WAIT_TIMEOUT_MILLIS = 50; };