summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-01-09 21:25:15 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-01-09 21:25:15 +0100
commitcff85a621e3fd5a4cf43809584dedfcd9e8b0efe (patch)
treef70a1846afd103d00edd3c757fc552eff16891cb
parent463c10f29efc6ef583b6eb3ed6117368eab9ccd9 (diff)
logic/libs: options/scoped: don't reset dialog on proto load failure
-rw-r--r--logic/selected-libraries.cpp15
-rw-r--r--options/scoped.hpp2
2 files changed, 13 insertions, 4 deletions
diff --git a/logic/selected-libraries.cpp b/logic/selected-libraries.cpp
index 4a1a9f09..ffa3e496 100644
--- a/logic/selected-libraries.cpp
+++ b/logic/selected-libraries.cpp
@@ -1,4 +1,5 @@
#include "selected-libraries.hpp"
+#include "options/scoped.hpp"
#include <QDebug>
SelectedLibraries::SelectedLibraries(QFrame* frame, dylibptr t, dylibptr p, dylibptr f) :
@@ -7,19 +8,25 @@ SelectedLibraries::SelectedLibraries(QFrame* frame, dylibptr t, dylibptr p, dyli
pProtocol(nullptr),
correct(false)
{
+ using namespace options;
+
+ const bool prev_teardown_flag = opts::is_tracker_teardown();
+
+ opts::set_teardown_flag(true);
+
pProtocol = make_dylib_instance<IProtocol>(p);
if (!pProtocol)
{
qDebug() << "protocol dylib load failure";
- return;
+ goto end;
}
if(!pProtocol->correct())
{
qDebug() << "protocol load failure";
pProtocol = nullptr;
- return;
+ goto end;
}
pTracker = make_dylib_instance<ITracker>(t);
@@ -28,10 +35,12 @@ SelectedLibraries::SelectedLibraries(QFrame* frame, dylibptr t, dylibptr p, dyli
if (!pTracker)
{
qDebug() << "tracker dylib load failure";
- return;
+ goto end;
}
pTracker->start_tracker(frame);
correct = true;
+end:
+ opts::set_teardown_flag(prev_teardown_flag);
}
diff --git a/options/scoped.hpp b/options/scoped.hpp
index 4ad51fea..fd797219 100644
--- a/options/scoped.hpp
+++ b/options/scoped.hpp
@@ -19,9 +19,9 @@ struct OPENTRACK_OPTIONS_EXPORT opts
// XXX hack: the flag shouldn't be here as action at distance -sh 20160926
static void set_teardown_flag(bool value);
+ static bool is_tracker_teardown();
private:
static std::atomic_bool teardown_flag;
- static bool is_tracker_teardown();
static void ensure_thread();
};