Qt: Connect destroyed() signal to flushAppSignals()

Connect destroyed(QWidget *) signal instead of finished(int) to
flushAppSignals(). This is to ensure that flushAppSignals() is executed
after any potential accepted() or rejected() slots.

This fixes the code flow for preferences update. That is, the signals are
first queued in PreferencesDialog::on_buttonBox_accepted() before
flushAppSignal() is executed.

Change-Id: Ie1497df66adb52cdc10d1b7c701f531d4eeb7351
Reviewed-on: https://code.wireshark.org/review/34823
Petri-Dish: Tomasz Moń <desowin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
Tomasz Moń 2019-10-21 17:23:37 +02:00 committed by Roland Knall
parent bc44c7e0cd
commit 7e2aada266
3 changed files with 6 additions and 7 deletions

View File

@ -2151,8 +2151,7 @@ void MainWindow::on_actionEditConfigurationProfiles_triggered()
void MainWindow::showPreferencesDialog(QString pane_name)
{
PreferencesDialog *pref_dialog = new PreferencesDialog(this);
connect(pref_dialog, SIGNAL(finished(int)), wsApp, SLOT(flushAppSignals()));
connect(pref_dialog, SIGNAL(destroyed(QObject*)), wsApp, SLOT(flushAppSignals()));
saveWindowGeometry(); // Save in case the layout panes are rearranged
pref_dialog->setPane(pane_name);
@ -2656,7 +2655,7 @@ void MainWindow::on_actionAnalyzeDisplayFilterMacros_triggered()
struct epan_uat* dfm_uat;
dfilter_macro_get_uat(&dfm_uat);
UatDialog *uat_dlg = new UatDialog(parentWidget(), dfm_uat);
connect(uat_dlg, SIGNAL(finished(int)), wsApp, SLOT(flushAppSignals()));
connect(uat_dlg, SIGNAL(destroyed(QObject*)), wsApp, SLOT(flushAppSignals()));
uat_dlg->setWindowModality(Qt::ApplicationModal);
uat_dlg->setAttribute(Qt::WA_DeleteOnClose);
@ -2705,7 +2704,7 @@ void MainWindow::applyExportObject()
void MainWindow::on_actionAnalyzeEnabledProtocols_triggered()
{
EnabledProtocolsDialog *enable_proto_dialog = new EnabledProtocolsDialog(this);
connect(enable_proto_dialog, SIGNAL(finished(int)), wsApp, SLOT(flushAppSignals()));
connect(enable_proto_dialog, SIGNAL(destroyed(QObject*)), wsApp, SLOT(flushAppSignals()));
enable_proto_dialog->setWindowModality(Qt::ApplicationModal);
enable_proto_dialog->setAttribute(Qt::WA_DeleteOnClose);
@ -2721,7 +2720,7 @@ void MainWindow::on_actionAnalyzeDecodeAs_triggered()
}
DecodeAsDialog *da_dialog = new DecodeAsDialog(this, capture_file_.capFile(), create_new);
connect(da_dialog, SIGNAL(finished(int)), wsApp, SLOT(flushAppSignals()));
connect(da_dialog, SIGNAL(destroyed(QObject*)), wsApp, SLOT(flushAppSignals()));
da_dialog->setWindowModality(Qt::ApplicationModal);
da_dialog->setAttribute(Qt::WA_DeleteOnClose);

View File

@ -597,7 +597,7 @@ void PacketList::ctxDecodeAsDialog()
bool create_new = da_action->property("create_new").toBool();
DecodeAsDialog *da_dialog = new DecodeAsDialog(this, cap_file_, create_new);
connect(da_dialog, SIGNAL(finished(int)), wsApp, SLOT(flushAppSignals()));
connect(da_dialog, SIGNAL(destroyed(QObject*)), wsApp, SLOT(flushAppSignals()));
da_dialog->setWindowModality(Qt::ApplicationModal);
da_dialog->setAttribute(Qt::WA_DeleteOnClose);
da_dialog->show();

View File

@ -84,7 +84,7 @@ public:
void showUatDialog() {
UatDialog *uat_dlg = new UatDialog(parentWidget(), prefs_get_uat_value(pref_));
connect(uat_dlg, SIGNAL(finished(int)), wsApp, SLOT(flushAppSignals()));
connect(uat_dlg, SIGNAL(destroyed(QObject*)), wsApp, SLOT(flushAppSignals()));
uat_dlg->setWindowModality(Qt::ApplicationModal);
uat_dlg->setAttribute(Qt::WA_DeleteOnClose);
uat_dlg->show();