summaryrefslogtreecommitdiffhomepage
path: root/proto-ft/mutex.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-04-06 17:35:09 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-04-06 17:35:18 +0200
commitbe1b4e083d3599d4e0ad1f483ff5fe1f7ee1178f (patch)
treeba5d4a508ac944b06b0de873677b45a7228b1048 /proto-ft/mutex.cpp
parent926b2b16c8df2e7c54de10780860176d2277e9b1 (diff)
proto/ft: only clear registry path on program exit
Clear registry path when opentrack exits, not merely tracking is stopped. This is still controlled by the checkbox, while checking for being the first instance happens always regardless. Also update dialog description. Issue: #332
Diffstat (limited to 'proto-ft/mutex.cpp')
-rwxr-xr-xproto-ft/mutex.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/proto-ft/mutex.cpp b/proto-ft/mutex.cpp
index 34f5f518..88021810 100755
--- a/proto-ft/mutex.cpp
+++ b/proto-ft/mutex.cpp
@@ -7,7 +7,20 @@ class check_for_first_run : public runonce
bool is_first_instance;
bool enabled;
+ void try_exit()
+ {
+ if (is_first_instance && enabled)
+ {
+ qDebug() << "ft runonce: removing registry keys";
+ FTNoIR_Protocol::set_protocols(false, false);
+ }
+ }
+
public:
+ check_for_first_run() : checked_for_first_run(false), is_first_instance(false), enabled(false)
+ {
+ }
+
bool is_first_run() override
{
return checked_for_first_run && is_first_instance;
@@ -23,7 +36,7 @@ public:
{
constexpr const char* name = "opentrack-freetrack-runonce";
- if (checked_for_first_run || !enabled)
+ if (checked_for_first_run)
return;
// just leak it, no issue
@@ -49,20 +62,6 @@ public:
qDebug() << "ft runonce:" << "first-run" << is_first_instance << "checked" << checked_for_first_run;
}
- void try_exit() override
- {
- if (is_first_instance && enabled)
- {
- qDebug() << "ft runonce: removing registry keys";
- FTNoIR_Protocol::set_protocols(false, false);
- }
- }
-
-public:
- check_for_first_run() : checked_for_first_run(false), is_first_instance(false), enabled(false)
- {
- }
-
~check_for_first_run()
{
try_exit();