Create m_update-object inside of constructor of worker-class:
this way the object belongs to the GUI-thread, and can be addressed via emit by the reporting thread.
This commit is contained in:
parent
3581dd4b1d
commit
0dffc1d1c2
22
worker.cpp
22
worker.cpp
@ -166,7 +166,13 @@ Worker::Worker(int customerNr,
|
|||||||
// TODO: turn object into singleton
|
// TODO: turn object into singleton
|
||||||
instance = this;
|
instance = this;
|
||||||
m_lastFailedUpdateStep = UPDATE_STEP::NONE;
|
m_lastFailedUpdateStep = UPDATE_STEP::NONE;
|
||||||
m_update = nullptr;
|
m_update = new Update(this,
|
||||||
|
QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr),
|
||||||
|
m_customerNrStr,
|
||||||
|
m_branchName,
|
||||||
|
m_pluginDir,
|
||||||
|
m_pluginName,
|
||||||
|
m_workingDirectory);
|
||||||
|
|
||||||
this->setObjectName("worker-object");
|
this->setObjectName("worker-object");
|
||||||
QDir::setCurrent(m_workingDirectory);
|
QDir::setCurrent(m_workingDirectory);
|
||||||
@ -175,6 +181,10 @@ Worker::Worker(int customerNr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Worker::~Worker() {
|
Worker::~Worker() {
|
||||||
|
if (m_update != nullptr) {
|
||||||
|
delete m_update;
|
||||||
|
m_update = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Worker::displayProgressInMainWindow(int progress) {
|
void Worker::displayProgressInMainWindow(int progress) {
|
||||||
@ -889,15 +899,7 @@ bool Worker::downloadFilesToPSAHardware() {
|
|||||||
QStringList lst = m_filesToDownload;
|
QStringList lst = m_filesToDownload;
|
||||||
ISMAS(lst) << (CONSOLE(lst) << UPDATE_STEP::FILES_TO_DOWNLOAD);
|
ISMAS(lst) << (CONSOLE(lst) << UPDATE_STEP::FILES_TO_DOWNLOAD);
|
||||||
|
|
||||||
m_update = new Update(this,
|
if (m_update && m_update->doUpdate(m_displayIndex, m_filesToDownload)) {
|
||||||
QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr),
|
|
||||||
m_customerNrStr,
|
|
||||||
m_branchName,
|
|
||||||
m_pluginDir,
|
|
||||||
m_pluginName,
|
|
||||||
m_workingDirectory);
|
|
||||||
|
|
||||||
if (m_update->doUpdate(m_displayIndex, m_filesToDownload)) {
|
|
||||||
// prepared for use: at the moment, the dc-library does not work
|
// prepared for use: at the moment, the dc-library does not work
|
||||||
// as expected.
|
// as expected.
|
||||||
|
|
||||||
|
4
worker.h
4
worker.h
@ -249,10 +249,6 @@ class Worker : public QThread{
|
|||||||
<< UPDATE_STEP::SEND_LAST_VERSION));
|
<< UPDATE_STEP::SEND_LAST_VERSION));
|
||||||
}
|
}
|
||||||
m_worker->stopProgressLoop();
|
m_worker->stopProgressLoop();
|
||||||
if (m_worker->m_update != nullptr) {
|
|
||||||
delete m_worker->m_update;
|
|
||||||
m_worker->m_update = nullptr;
|
|
||||||
}
|
|
||||||
m_worker->m_updateProcessRunning = false;
|
m_worker->m_updateProcessRunning = false;
|
||||||
emit m_worker->enableExit();
|
emit m_worker->enableExit();
|
||||||
emit m_worker->restartExitTimer();
|
emit m_worker->restartExitTimer();
|
||||||
|
Loading…
Reference in New Issue
Block a user