summaryrefslogtreecommitdiffhomepage
path: root/facetracknoir
diff options
context:
space:
mode:
Diffstat (limited to 'facetracknoir')
-rw-r--r--facetracknoir/facetracknoir.cpp3
-rw-r--r--facetracknoir/tracker.cpp6
-rw-r--r--facetracknoir/tracker.h9
3 files changed, 11 insertions, 7 deletions
diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp
index b83f59d7..d93f2131 100644
--- a/facetracknoir/facetracknoir.cpp
+++ b/facetracknoir/facetracknoir.cpp
@@ -360,7 +360,6 @@ void FaceTrackNoIR::startTracker( ) {
#endif
if (tracker) {
- tracker->wait();
delete tracker;
}
@@ -418,8 +417,6 @@ void FaceTrackNoIR::stopTracker( ) {
pFilterDialog->unregisterFilter();
if ( tracker ) {
- tracker->should_quit = true;
- tracker->wait();
delete tracker;
tracker = 0;
if (Libraries) {
diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp
index fa1cdee1..57762640 100644
--- a/facetracknoir/tracker.cpp
+++ b/facetracknoir/tracker.cpp
@@ -31,6 +31,12 @@ Tracker::Tracker(FaceTrackNoIR *parent , main_settings& s) :
{
}
+Tracker::~Tracker()
+{
+ should_quit = true;
+ wait();
+}
+
static void get_curve(double pos, double& out, THeadPoseDOF& axis) {
bool altp = (pos < 0) && axis.opts.altp;
if (altp) {
diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h
index 7ebece02..a33d8e0d 100644
--- a/facetracknoir/tracker.h
+++ b/facetracknoir/tracker.h
@@ -51,28 +51,29 @@ public:
axis_opts& opts;
};
-class Tracker : public QThread {
+class Tracker : protected QThread {
Q_OBJECT
private:
FaceTrackNoIR *mainApp;
QMutex mtx;
main_settings& s;
-
+ volatile bool should_quit;
protected:
void run();
public:
Tracker( FaceTrackNoIR *parent, main_settings& s);
+ ~Tracker();
void getHeadPose(double *data);
void getOutputHeadPose(double *data);
-
- volatile bool should_quit;
volatile bool do_center;
volatile bool enabled;
T6DOF output_camera;
+
+ void start() { QThread::start(); }
};
class HeadPoseData {