@@ -19,6 +19,7 @@ MainWindow::MainWindow(QWidget *parent)
1919 this , &MainWindow::slot_set_control_states);
2020 connect (m_ui->button_CrashIt , &QPushButton::clicked, this , &MainWindow::slot_crash_it);
2121 connect (m_ui->button_Cancel , &QPushButton::clicked, qApp, &QApplication::quit);
22+ connect (m_ui->button_Refresh , &QPushButton::clicked, this , &MainWindow::slot_manual_refresh);
2223
2324 connect (m_ui->combo_Processes , static_cast <void (QComboBox::*)(int )>(&QComboBox::currentIndexChanged), this , &MainWindow::slot_process_changed);
2425
@@ -36,6 +37,12 @@ MainWindow::~MainWindow()
3637 delete m_ui;
3738}
3839
40+ void MainWindow::slot_manual_refresh ()
41+ {
42+ m_refresh_button = true ;
43+ QTimer::singleShot (0 , this , &MainWindow::slot_enumerate_processes);
44+ }
45+
3946void MainWindow::slot_process_changed (int index)
4047{
4148 auto data = m_ui->combo_Processes ->itemData (index).value <process_data_t >();
@@ -139,6 +146,8 @@ void MainWindow::slot_crash_it()
139146 }
140147 }
141148
149+ m_thunderbold_just_ran = true ;
150+
142151 slot_set_control_states ();
143152}
144153
@@ -316,16 +325,20 @@ void MainWindow::slot_enumerate_processes()
316325 }
317326 }
318327
319- if (parent_index == -1 )
328+ if (parent_index == -1 && !m_thunderbold_just_ran )
320329 {
321330 QMessageBox::critical (this , m_title, tr (" Could not identify the Firefox process!" ));
322- QTimer::singleShot (0 , qApp, &QApplication::quit);
331+ if (!m_refresh_button)
332+ QTimer::singleShot (0 , qApp, &QApplication::quit);
323333 }
324334 else
325335 {
326336 m_ui->combo_Processes ->setCurrentIndex (parent_index);
327337 slot_process_changed (parent_index);
328338 }
339+
340+ m_thunderbold_just_ran = false ;
341+ m_refresh_button = false ;
329342 }
330343
331344 slot_set_control_states ();
0 commit comments