Fix thread no-stop bug

This commit is contained in:
Krad
2022-01-14 14:19:56 +08:00
parent a5f37a0ab1
commit 873c41f9a1
3 changed files with 11 additions and 3 deletions

View File

@@ -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;
}

View File

@@ -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;
};

View File

@@ -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()