summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-09-13 14:02:08 +0200
committerStanislaw Halik <sthalik@misaki.pl>2013-09-13 14:02:08 +0200
commitc9bfd9b3a6fd40d8d63cb25c8d746e6a4adb532f (patch)
tree21a7bdc4a9654865c3af594bfb298571e5dd8265
parent877ae430dc80280b00ef508f790db6cf0a9d862b (diff)
Reorder side effects to avoid use-after-free
-rw-r--r--facetracknoir/facetracknoir.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp
index 8224b35f..da2ce21f 100644
--- a/facetracknoir/facetracknoir.cpp
+++ b/facetracknoir/facetracknoir.cpp
@@ -765,6 +765,18 @@ void FaceTrackNoIR::stopTracker( ) {
ui.lcdNumOutputRotX->setVisible(false);
ui.lcdNumOutputRotY->setVisible(false);
ui.lcdNumOutputRotZ->setVisible(false);
+
+ //
+ // UnRegister the Tracker instance with the Tracker Dialog (if open)
+ //
+ if (pTrackerDialog) {
+ pTrackerDialog->unRegisterTracker();
+ }
+ if (pProtocolDialog) {
+ pProtocolDialog->unRegisterProtocol();
+ }
+ if (pFilterDialog)
+ pFilterDialog->Initialize(this, NULL);
//
// Delete the tracker (after stopping things and all).
@@ -783,16 +795,6 @@ void FaceTrackNoIR::stopTracker( ) {
Libraries = NULL;
}
}
-
- //
- // UnRegister the Tracker instance with the Tracker Dialog (if open)
- //
- if (pTrackerDialog) {
- pTrackerDialog->unRegisterTracker();
- }
- if (pProtocolDialog) {
- pProtocolDialog->unRegisterProtocol();
- }
ui.btnStartTracker->setEnabled ( true );
ui.btnStopTracker->setEnabled ( false );
// ui.btnShowEngineControls->setEnabled ( false );