summaryrefslogtreecommitdiffhomepage
path: root/proto-ft
diff options
context:
space:
mode:
Diffstat (limited to 'proto-ft')
-rw-r--r--proto-ft/mutex.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/proto-ft/mutex.cpp b/proto-ft/mutex.cpp
index 63cf4334..073c6f08 100644
--- a/proto-ft/mutex.cpp
+++ b/proto-ft/mutex.cpp
@@ -15,19 +15,18 @@ bool check_for_first_run::is_first_run()
void check_for_first_run::set_enabled(bool flag)
{
enabled = flag;
- qDebug() << "ft runonce:" << "enabled" << flag;
}
void check_for_first_run::try_runonce()
{
constexpr const char* name = "opentrack-freetrack-runonce";
-
+
if (checked_for_first_run)
return;
-
+
// just leak it, no issue
HANDLE h = CreateMutexA(nullptr, false, name);
-
+
switch (WaitForSingleObject(h, 0))
{
case WAIT_OBJECT_0:
@@ -41,11 +40,9 @@ void check_for_first_run::try_runonce()
checked_for_first_run = false;
break;
}
-
+
if (checked_for_first_run && !is_first_instance)
CloseHandle(h);
-
- qDebug() << "ft runonce:" << "enabled" << enabled << "first-run" << is_first_instance << "checked" << checked_for_first_run;
}
check_for_first_run::~check_for_first_run()
@@ -55,7 +52,6 @@ check_for_first_run::~check_for_first_run()
void check_for_first_run::try_exit()
{
- qDebug() << "ft runonce enabled:" << enabled;
if (is_first_instance && enabled)
{
qDebug() << "ft runonce: removing registry keys";