Use of pointer m_update.

This commit is contained in:
Gerhard Hoffmann 2024-02-05 16:26:53 +01:00
parent 978e98b2ee
commit 80712964ef
2 changed files with 14 additions and 11 deletions

View File

@ -165,8 +165,8 @@ Worker::Worker(int customerNr,
// TODO: turn object into singleton
instance = this;
m_lastFailedUpdateStep = UPDATE_STEP::NONE;
m_update = nullptr;
this->setObjectName("worker-object");
QDir::setCurrent(m_workingDirectory);
@ -752,7 +752,7 @@ bool Worker::filesToUpdate() {
}
m_filesToUpdate.removeDuplicates();
qCritical() << __PRETTY_FUNCTION__ << "FILES-TO-UPDATE" << m_filesToUpdate;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") FILES-TO-UPDATE" << m_filesToUpdate;
GUI(m_filesToUpdate) << (CONSOLE(m_filesToUpdate) << UPDATE_STEP::FILES_TO_UPDATE);
setProgress(_FILES_TO_UPDATE);
@ -889,15 +889,15 @@ bool Worker::downloadFilesToPSAHardware() {
QStringList lst = m_filesToDownload;
ISMAS(lst) << (CONSOLE(lst) << UPDATE_STEP::FILES_TO_DOWNLOAD);
Update update(this,
QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr),
m_customerNrStr,
m_branchName,
m_pluginDir,
m_pluginName,
m_workingDirectory);
m_update = new Update(this,
QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr),
m_customerNrStr,
m_branchName,
m_pluginDir,
m_pluginName,
m_workingDirectory);
if (update.doUpdate(m_displayIndex, m_filesToDownload)) {
if (m_update->doUpdate(m_displayIndex, m_filesToDownload)) {
// prepared for use: at the moment, the dc-library does not work
// as expected.

View File

@ -249,7 +249,10 @@ class Worker : public QThread{
<< UPDATE_STEP::SEND_LAST_VERSION));
}
m_worker->stopProgressLoop();
if (m_worker->m_update != nullptr) {
delete m_worker->m_update;
m_worker->m_update = nullptr;
}
m_worker->m_updateProcessRunning = false;
emit m_worker->enableExit();
emit m_worker->restartExitTimer();