diff --git a/src/device/DeviceManager.cpp b/src/device/DeviceManager.cpp index 1e22d63..f947d6b 100644 --- a/src/device/DeviceManager.cpp +++ b/src/device/DeviceManager.cpp @@ -300,3 +300,8 @@ void DeviceManager::processScan(const char* json, bool empty) { THROW_ERROR(errmsg); qDebug() << ">>>>>>>>>>>>>>>>>>>>>ScanControl failed"; } + +void DeviceManager::close() { + previewDataCaller->terminate(); + delete previewDataCaller; +} diff --git a/src/device/DeviceManager.h b/src/device/DeviceManager.h index 3b67480..79e1e97 100644 --- a/src/device/DeviceManager.h +++ b/src/device/DeviceManager.h @@ -16,6 +16,7 @@ public: return &manager; } void initDevice(); + void close(); void setErrorOccurred(bool v){ errorOccurred = v; } @@ -35,7 +36,7 @@ private: int deviceInfTimerID = -1; int lastStatus = -1; bool previewing = false; - bool endLoop = false; + volatile bool endLoop = false; bool errorOccurred = false; QThread* previewDataCaller; }; diff --git a/src/systemsettingform.cpp b/src/systemsettingform.cpp index 5c9a14c..e722cb4 100644 --- a/src/systemsettingform.cpp +++ b/src/systemsettingform.cpp @@ -157,8 +157,10 @@ systemSettingForm::systemSettingForm(QWidget* parent) : systemSettingForm::~systemSettingForm() { - diskInfoCaller->quit(); - diskInfoCaller->wait(); + diskInfoCaller->terminate(); +// diskInfoCaller->quit(); +// diskInfoCaller->wait(); + delete diskInfoCaller; } void systemSettingForm::updateStorageUsed()