From 8411ba0b7498d9e3c6a870ca058ac36fdabf6c08 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Sat, 11 Jun 2016 11:48:13 -0700 Subject: [PATCH] Correct thread destruction --- src/AutoPilotPlugins/APM/APMCompassCal.cc | 8 ++++++-- src/AutoPilotPlugins/PX4/SensorsComponent.qml | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/AutoPilotPlugins/APM/APMCompassCal.cc b/src/AutoPilotPlugins/APM/APMCompassCal.cc index a430cd427..f2a61daeb 100644 --- a/src/AutoPilotPlugins/APM/APMCompassCal.cc +++ b/src/AutoPilotPlugins/APM/APMCompassCal.cc @@ -579,7 +579,11 @@ APMCompassCal::APMCompassCal(void) APMCompassCal::~APMCompassCal() { - + if (_calWorkerThread) { + _calWorkerThread->terminate(); + // deleteLater so it happens on correct thread + _calWorkerThread->deleteLater(); + } } void APMCompassCal::setVehicle(Vehicle* vehicle) @@ -601,7 +605,7 @@ void APMCompassCal::startCalibration(void) // Simulate a start message _emitVehicleTextMessage("[cal] calibration started: mag"); - _calWorkerThread = new CalWorkerThread(_vehicle, this); + _calWorkerThread = new CalWorkerThread(_vehicle); connect(_calWorkerThread, &CalWorkerThread::vehicleTextMessage, this, &APMCompassCal::vehicleTextMessage); // Clear the offset parameters so we get raw data diff --git a/src/AutoPilotPlugins/PX4/SensorsComponent.qml b/src/AutoPilotPlugins/PX4/SensorsComponent.qml index 6290c6bca..1e99493da 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponent.qml +++ b/src/AutoPilotPlugins/PX4/SensorsComponent.qml @@ -461,6 +461,8 @@ QGCView { property real indicatorWidth: (width / 3) - (spacing * 2) property real indicatorHeight: (height / 2) - spacing + Component.onCompleted: console.log("indicatorWidth", indicatorWidth, "indicatorHeight", indicatorHeight) + VehicleRotationCal { width: parent.indicatorWidth height: parent.indicatorHeight -- 2.22.0