Deleted the download thread in a Qt way #4235
This commit is contained in:
parent
17278f7224
commit
e6e4f1b53d
|
@ -88,8 +88,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
|
||||||
m_DownloadMessageBox(NULL),
|
m_DownloadMessageBox(NULL),
|
||||||
m_pCancelButton(NULL),
|
m_pCancelButton(NULL),
|
||||||
m_SuppressAutoConfigWarning(false),
|
m_SuppressAutoConfigWarning(false),
|
||||||
m_BonjourInstall(NULL),
|
m_BonjourInstall(NULL)
|
||||||
m_BonjourInstallThread(NULL)
|
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
|
@ -143,10 +142,6 @@ MainWindow::~MainWindow()
|
||||||
if (m_BonjourInstall != NULL) {
|
if (m_BonjourInstall != NULL) {
|
||||||
delete m_BonjourInstall;
|
delete m_BonjourInstall;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_BonjourInstallThread != NULL) {
|
|
||||||
delete m_BonjourInstallThread;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::open()
|
void MainWindow::open()
|
||||||
|
@ -1111,13 +1106,16 @@ void MainWindow::installBonjour()
|
||||||
if (m_BonjourInstall == NULL) {
|
if (m_BonjourInstall == NULL) {
|
||||||
m_BonjourInstall = new CommandProcess("msiexec", arguments);
|
m_BonjourInstall = new CommandProcess("msiexec", arguments);
|
||||||
}
|
}
|
||||||
if (m_BonjourInstallThread == NULL) {
|
|
||||||
m_BonjourInstallThread = new QThread;
|
QThread* thread = new QThread;
|
||||||
}
|
|
||||||
m_BonjourInstall->moveToThread(m_BonjourInstallThread);
|
|
||||||
connect(m_BonjourInstall, SIGNAL(finished()), this,
|
connect(m_BonjourInstall, SIGNAL(finished()), this,
|
||||||
SLOT(bonjourInstallFinished()));
|
SLOT(bonjourInstallFinished()));
|
||||||
m_BonjourInstallThread->start();
|
connect(m_BonjourInstall, SIGNAL(finished()), thread, SLOT(quit()));
|
||||||
|
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||||
|
|
||||||
|
m_BonjourInstall->moveToThread(thread);
|
||||||
|
thread->start();
|
||||||
|
|
||||||
QMetaObject::invokeMethod(m_BonjourInstall, "run", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(m_BonjourInstall, "run", Qt::QueuedConnection);
|
||||||
|
|
||||||
m_DownloadMessageBox->hide();
|
m_DownloadMessageBox->hide();
|
||||||
|
@ -1184,11 +1182,7 @@ void MainWindow::on_m_pCheckBoxAutoConfig_toggled(bool checked)
|
||||||
|
|
||||||
void MainWindow::bonjourInstallFinished()
|
void MainWindow::bonjourInstallFinished()
|
||||||
{
|
{
|
||||||
delete m_BonjourInstall;
|
appendLogNote("Bonjour install finished");
|
||||||
m_BonjourInstall = NULL;
|
|
||||||
|
|
||||||
delete m_BonjourInstallThread;
|
|
||||||
m_BonjourInstallThread = NULL;
|
|
||||||
|
|
||||||
updateZeroconfService();
|
updateZeroconfService();
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||||
QMutex m_Mutex;
|
QMutex m_Mutex;
|
||||||
bool m_SuppressAutoConfigWarning;
|
bool m_SuppressAutoConfigWarning;
|
||||||
CommandProcess* m_BonjourInstall;
|
CommandProcess* m_BonjourInstall;
|
||||||
QThread* m_BonjourInstallThread;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_m_pCheckBoxAutoConfig_toggled(bool checked);
|
void on_m_pCheckBoxAutoConfig_toggled(bool checked);
|
||||||
|
|
Loading…
Reference in New Issue