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_pCancelButton(NULL),
|
||||
m_SuppressAutoConfigWarning(false),
|
||||
m_BonjourInstall(NULL),
|
||||
m_BonjourInstallThread(NULL)
|
||||
m_BonjourInstall(NULL)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
|
@ -143,10 +142,6 @@ MainWindow::~MainWindow()
|
|||
if (m_BonjourInstall != NULL) {
|
||||
delete m_BonjourInstall;
|
||||
}
|
||||
|
||||
if (m_BonjourInstallThread != NULL) {
|
||||
delete m_BonjourInstallThread;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::open()
|
||||
|
@ -1111,13 +1106,16 @@ void MainWindow::installBonjour()
|
|||
if (m_BonjourInstall == NULL) {
|
||||
m_BonjourInstall = new CommandProcess("msiexec", arguments);
|
||||
}
|
||||
if (m_BonjourInstallThread == NULL) {
|
||||
m_BonjourInstallThread = new QThread;
|
||||
}
|
||||
m_BonjourInstall->moveToThread(m_BonjourInstallThread);
|
||||
|
||||
QThread* thread = new QThread;
|
||||
connect(m_BonjourInstall, SIGNAL(finished()), this,
|
||||
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);
|
||||
|
||||
m_DownloadMessageBox->hide();
|
||||
|
@ -1184,11 +1182,7 @@ void MainWindow::on_m_pCheckBoxAutoConfig_toggled(bool checked)
|
|||
|
||||
void MainWindow::bonjourInstallFinished()
|
||||
{
|
||||
delete m_BonjourInstall;
|
||||
m_BonjourInstall = NULL;
|
||||
|
||||
delete m_BonjourInstallThread;
|
||||
m_BonjourInstallThread = NULL;
|
||||
appendLogNote("Bonjour install finished");
|
||||
|
||||
updateZeroconfService();
|
||||
}
|
||||
|
|
|
@ -191,7 +191,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
|||
QMutex m_Mutex;
|
||||
bool m_SuppressAutoConfigWarning;
|
||||
CommandProcess* m_BonjourInstall;
|
||||
QThread* m_BonjourInstallThread;
|
||||
|
||||
private slots:
|
||||
void on_m_pCheckBoxAutoConfig_toggled(bool checked);
|
||||
|
|
Loading…
Reference in New Issue