From 8bdd22bccfb8df345d0a03f6c575bfc792027874 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 3 Jul 2015 15:21:49 +0200 Subject: simconnect: don't race against initialization Issue: #174 --- ftnoir_protocol_sc/ftnoir_protocol_sc.cpp | 8 ++------ ftnoir_protocol_sc/ftnoir_protocol_sc.h | 2 -- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp index 8e35248e..02ad497d 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp @@ -31,9 +31,8 @@ static QLibrary SCClientLib; -FTNoIR_Protocol::FTNoIR_Protocol() : should_stop(false), hSimConnect(nullptr), should_start(false) +FTNoIR_Protocol::FTNoIR_Protocol() : should_stop(false), hSimConnect(nullptr) { - start(); } FTNoIR_Protocol::~FTNoIR_Protocol() @@ -44,9 +43,6 @@ FTNoIR_Protocol::~FTNoIR_Protocol() void FTNoIR_Protocol::run() { - if (!should_start) - return; - if (SUCCEEDED(simconnect_open(&hSimConnect, "FaceTrackNoIR", NULL, 0, 0, 0))) { simconnect_subscribetosystemevent(hSimConnect, EVENT_PING, "Frame"); @@ -185,7 +181,7 @@ bool FTNoIR_Protocol::correct() qDebug() << "FTNoIR_Protocol::correct() says: SimConnect functions resolved in DLL!"; - should_start = true; + start(); return true; } diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.h b/ftnoir_protocol_sc/ftnoir_protocol_sc.h index 3ced16e5..b65bac85 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.h +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.h @@ -126,8 +126,6 @@ private: HANDLE hSimConnect; // Handle to SimConnect static void CALLBACK processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWORD cbData, void *pContext); settings s; - - bool should_start; }; class SCControls: public IProtocolDialog -- cgit v1.2.3