Don't emit app signals from dialogs.
Emitting PacketDissectionChanged from a dialog on can render the main window unusable on OS X. A workaround for this was added to the preferences dialog in g8fc2327. Generalize the workaround and use it elsewhere. Fix the "Enabled Protocols" action name while we're here. Bug: 11361 Bug: 11448 Change-Id: I89e98daaaedc877d3b13b0d33b6f3be033e323d7 Reviewed-on: https://code.wireshark.org/review/10271 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
parent
8ad5611750
commit
374439daa1
|
@ -587,7 +587,7 @@ void DecodeAsDialog::applyChanges()
|
||||||
delete(dissector_info);
|
delete(dissector_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
|
wsApp->queueAppSignal(WiresharkApplication::PacketDissectionChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecodeAsDialog::on_buttonBox_clicked(QAbstractButton *button)
|
void DecodeAsDialog::on_buttonBox_clicked(QAbstractButton *button)
|
||||||
|
|
|
@ -46,6 +46,7 @@ enum
|
||||||
heuristic_type_ = 1002
|
heuristic_type_ = 1002
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
class EnableProtocolTreeWidgetItem : public QTreeWidgetItem
|
class EnableProtocolTreeWidgetItem : public QTreeWidgetItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -245,11 +246,11 @@ bool EnabledProtocolsDialog::applyChanges()
|
||||||
|
|
||||||
if ((*it)->checkState(PROTOCOL_COLUMN) == Qt::Checked)
|
if ((*it)->checkState(PROTOCOL_COLUMN) == Qt::Checked)
|
||||||
{
|
{
|
||||||
redissect |= it_cast->applyValue(TRUE);
|
redissect |= it_cast->applyValue(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
redissect |= it_cast->applyValue(FALSE);
|
redissect |= it_cast->applyValue(false);
|
||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
@ -311,10 +312,13 @@ void EnabledProtocolsDialog::on_buttonBox_accepted()
|
||||||
if (applyChanges())
|
if (applyChanges())
|
||||||
{
|
{
|
||||||
writeChanges();
|
writeChanges();
|
||||||
wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
|
wsApp->queueAppSignal(WiresharkApplication::PacketDissectionChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// If we ever find and fix the bug behind queueAppSignal we can re-enable
|
||||||
|
// this.
|
||||||
void EnabledProtocolsDialog::on_buttonBox_clicked(QAbstractButton *button)
|
void EnabledProtocolsDialog::on_buttonBox_clicked(QAbstractButton *button)
|
||||||
{
|
{
|
||||||
if (button == ui->buttonBox->button(QDialogButtonBox::Apply))
|
if (button == ui->buttonBox->button(QDialogButtonBox::Apply))
|
||||||
|
@ -328,8 +332,8 @@ void EnabledProtocolsDialog::on_buttonBox_clicked(QAbstractButton *button)
|
||||||
wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
|
wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void EnabledProtocolsDialog::on_buttonBox_helpRequested()
|
void EnabledProtocolsDialog::on_buttonBox_helpRequested()
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,9 @@ private slots:
|
||||||
void on_disable_all_button__clicked();
|
void on_disable_all_button__clicked();
|
||||||
void on_search_line_edit__textChanged(const QString &search_re);
|
void on_search_line_edit__textChanged(const QString &search_re);
|
||||||
void on_buttonBox_accepted();
|
void on_buttonBox_accepted();
|
||||||
|
#if 0
|
||||||
void on_buttonBox_clicked(QAbstractButton *button);
|
void on_buttonBox_clicked(QAbstractButton *button);
|
||||||
|
#endif
|
||||||
void on_buttonBox_helpRequested();
|
void on_buttonBox_helpRequested();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -100,7 +100,7 @@
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="standardButtons">
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok|QDialogButtonBox::Save</set>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok|QDialogButtonBox::Save</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -2604,7 +2604,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionAnalyzeEnabledProtocols">
|
<action name="actionAnalyzeEnabledProtocols">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Enable Protocols…</string>
|
<string>Enabled Protocols…</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Enable and disable specific protocols</string>
|
<string>Enable and disable specific protocols</string>
|
||||||
|
|
|
@ -1972,11 +1972,9 @@ void MainWindow::showPreferencesDialog(PreferencesDialog::PreferencesPane start_
|
||||||
pref_dialog.setPane(start_pane);
|
pref_dialog.setPane(start_pane);
|
||||||
pref_dialog.exec();
|
pref_dialog.exec();
|
||||||
|
|
||||||
// Emitting PacketDissectionChanged directly from PreferencesDialog
|
// Emitting PacketDissectionChanged directly from a QDialog can cause
|
||||||
// can cause problems. Queue them up and emit them here.
|
// problems on OS X.
|
||||||
foreach (WiresharkApplication::AppSignal app_signal, pref_dialog.appSignals()) {
|
wsApp->flushAppSignals();
|
||||||
wsApp->emitAppSignal(app_signal);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::showPreferencesDialog(QString module_name)
|
void MainWindow::showPreferencesDialog(QString module_name)
|
||||||
|
@ -1986,11 +1984,9 @@ void MainWindow::showPreferencesDialog(QString module_name)
|
||||||
pref_dialog.setPane(module_name);
|
pref_dialog.setPane(module_name);
|
||||||
pref_dialog.exec();
|
pref_dialog.exec();
|
||||||
|
|
||||||
// Emitting PacketDissectionChanged directly from PreferencesDialog
|
// Emitting PacketDissectionChanged directly from a QDialog can cause
|
||||||
// can cause problems. Queue them up and emit them here.
|
// problems on OS X.
|
||||||
foreach (WiresharkApplication::AppSignal app_signal, pref_dialog.appSignals()) {
|
wsApp->flushAppSignals();
|
||||||
wsApp->emitAppSignal(app_signal);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionEditPreferences_triggered()
|
void MainWindow::on_actionEditPreferences_triggered()
|
||||||
|
@ -2369,6 +2365,9 @@ void MainWindow::on_actionAnalyzeDisplayFilterMacros_triggered()
|
||||||
UatDialog uat_dlg(parentWidget(), dfm_uat);
|
UatDialog uat_dlg(parentWidget(), dfm_uat);
|
||||||
|
|
||||||
uat_dlg.exec();
|
uat_dlg.exec();
|
||||||
|
// Emitting PacketDissectionChanged directly from a QDialog can cause
|
||||||
|
// problems on OS X.
|
||||||
|
wsApp->flushAppSignals();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionAnalyzeCreateAColumn_triggered()
|
void MainWindow::on_actionAnalyzeCreateAColumn_triggered()
|
||||||
|
@ -2466,6 +2465,10 @@ void MainWindow::on_actionAnalyzeEnabledProtocols_triggered()
|
||||||
{
|
{
|
||||||
EnabledProtocolsDialog enable_proto_dialog(this);
|
EnabledProtocolsDialog enable_proto_dialog(this);
|
||||||
enable_proto_dialog.exec();
|
enable_proto_dialog.exec();
|
||||||
|
|
||||||
|
// Emitting PacketDissectionChanged directly from a QDialog can cause
|
||||||
|
// problems on OS X.
|
||||||
|
wsApp->flushAppSignals();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionAnalyzeDecodeAs_triggered()
|
void MainWindow::on_actionAnalyzeDecodeAs_triggered()
|
||||||
|
@ -2480,6 +2483,10 @@ void MainWindow::on_actionAnalyzeDecodeAs_triggered()
|
||||||
connect(this, SIGNAL(setCaptureFile(capture_file*)),
|
connect(this, SIGNAL(setCaptureFile(capture_file*)),
|
||||||
&da_dialog, SLOT(setCaptureFile(capture_file*)));
|
&da_dialog, SLOT(setCaptureFile(capture_file*)));
|
||||||
da_dialog.exec();
|
da_dialog.exec();
|
||||||
|
|
||||||
|
// Emitting PacketDissectionChanged directly from a QDialog can cause
|
||||||
|
// problems on OS X.
|
||||||
|
wsApp->flushAppSignals();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LUA
|
#ifdef HAVE_LUA
|
||||||
|
|
|
@ -842,14 +842,11 @@ void PreferencesDialog::on_buttonBox_accepted()
|
||||||
|
|
||||||
wsApp->setMonospaceFont(prefs.gui_qt_font_name);
|
wsApp->setMonospaceFont(prefs.gui_qt_font_name);
|
||||||
|
|
||||||
/* Now destroy the "Preferences" dialog. */
|
|
||||||
// window_destroy(GTK_WIDGET(parent_w));
|
|
||||||
|
|
||||||
if (must_redissect) {
|
if (must_redissect) {
|
||||||
/* Redissect all the packets, and re-evaluate the display filter. */
|
/* Redissect all the packets, and re-evaluate the display filter. */
|
||||||
app_signals_ << WiresharkApplication::PacketDissectionChanged;
|
wsApp->queueAppSignal(WiresharkApplication::PacketDissectionChanged);
|
||||||
}
|
}
|
||||||
app_signals_ << WiresharkApplication::PreferencesChanged;
|
wsApp->queueAppSignal(WiresharkApplication::PreferencesChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::on_buttonBox_helpRequested()
|
void PreferencesDialog::on_buttonBox_helpRequested()
|
||||||
|
|
|
@ -64,8 +64,6 @@ public:
|
||||||
void setPane(PreferencesPane start_pane);
|
void setPane(PreferencesPane start_pane);
|
||||||
void setPane(const QString module_name);
|
void setPane(const QString module_name);
|
||||||
|
|
||||||
const QList<WiresharkApplication::AppSignal> appSignals() const { return app_signals_; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent *evt);
|
void showEvent(QShowEvent *evt);
|
||||||
void keyPressEvent(QKeyEvent *evt);
|
void keyPressEvent(QKeyEvent *evt);
|
||||||
|
@ -81,7 +79,6 @@ private:
|
||||||
QString saved_string_pref_;
|
QString saved_string_pref_;
|
||||||
QComboBox *cur_combo_box_;
|
QComboBox *cur_combo_box_;
|
||||||
int saved_combo_idx_;
|
int saved_combo_idx_;
|
||||||
QList<WiresharkApplication::AppSignal> app_signals_;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_prefsTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
void on_prefsTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
||||||
|
|
|
@ -101,6 +101,9 @@ public:
|
||||||
void showUatDialog() {
|
void showUatDialog() {
|
||||||
UatDialog uat_dlg(parentWidget(), pref_->varp.uat);
|
UatDialog uat_dlg(parentWidget(), pref_->varp.uat);
|
||||||
uat_dlg.exec();
|
uat_dlg.exec();
|
||||||
|
// Emitting PacketDissectionChanged directly from a QDialog can cause
|
||||||
|
// problems on OS X.
|
||||||
|
wsApp->flushAppSignals();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -289,6 +289,10 @@ void SCTPChunkStatisticsDialog::on_actionChunkTypePreferences_triggered()
|
||||||
|
|
||||||
UatDialog *uatdialog = new UatDialog(this, pref->varp.uat);
|
UatDialog *uatdialog = new UatDialog(this, pref->varp.uat);
|
||||||
uatdialog->exec();
|
uatdialog->exec();
|
||||||
|
// Emitting PacketDissectionChanged directly from a QDialog can cause
|
||||||
|
// problems on OS X.
|
||||||
|
wsApp->flushAppSignals();
|
||||||
|
|
||||||
ui->tableWidget->clear();
|
ui->tableWidget->clear();
|
||||||
ui->tableWidget->setRowCount(0);
|
ui->tableWidget->setRowCount(0);
|
||||||
ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(QString(tr("Association"))));
|
ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(QString(tr("Association"))));
|
||||||
|
|
|
@ -496,11 +496,11 @@ void UatDialog::applyChanges()
|
||||||
|
|
||||||
if (uat_->flags & UAT_AFFECTS_FIELDS) {
|
if (uat_->flags & UAT_AFFECTS_FIELDS) {
|
||||||
/* Recreate list with new fields and redissect packets */
|
/* Recreate list with new fields and redissect packets */
|
||||||
wsApp->emitAppSignal(WiresharkApplication::FieldsChanged);
|
wsApp->queueAppSignal(WiresharkApplication::FieldsChanged);
|
||||||
}
|
}
|
||||||
if (uat_->flags & UAT_AFFECTS_DISSECTION) {
|
if (uat_->flags & UAT_AFFECTS_DISSECTION) {
|
||||||
/* Just redissect packets if we have any */
|
/* Just redissect packets if we have any */
|
||||||
wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
|
wsApp->queueAppSignal(WiresharkApplication::PacketDissectionChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -661,6 +661,26 @@ void WiresharkApplication::emitAppSignal(AppSignal signal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Flush any collected app signals.
|
||||||
|
//
|
||||||
|
// On OS X emitting PacketDissectionChanged from a dialog can
|
||||||
|
// render the application unusable:
|
||||||
|
// https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=11361
|
||||||
|
// https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=11448
|
||||||
|
// Work around the problem by queueing up app signals and emitting them
|
||||||
|
// after the dialog is closed.
|
||||||
|
//
|
||||||
|
// The following bugs might be related although they don't describe the
|
||||||
|
// exact behavior we're working around here:
|
||||||
|
// https://bugreports.qt.io/browse/QTBUG-38512
|
||||||
|
// https://bugreports.qt.io/browse/QTBUG-38600
|
||||||
|
void WiresharkApplication::flushAppSignals()
|
||||||
|
{
|
||||||
|
while (!app_signals_.isEmpty()) {
|
||||||
|
wsApp->emitAppSignal(app_signals_.takeFirst());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WiresharkApplication::emitStatCommandSignal(const QString &menu_path, const char *arg, void *userdata)
|
void WiresharkApplication::emitStatCommandSignal(const QString &menu_path, const char *arg, void *userdata)
|
||||||
{
|
{
|
||||||
emit openStatCommandDialog(menu_path, arg, userdata);
|
emit openStatCommandDialog(menu_path, arg, userdata);
|
||||||
|
|
|
@ -72,6 +72,13 @@ public:
|
||||||
|
|
||||||
void registerUpdate(register_action_e action, const char *message);
|
void registerUpdate(register_action_e action, const char *message);
|
||||||
void emitAppSignal(AppSignal signal);
|
void emitAppSignal(AppSignal signal);
|
||||||
|
// Emitting app signals (PacketDissectionChanged in particular) from
|
||||||
|
// dialogs on OS X can be problematic. Dialogs should call queueAppSignal
|
||||||
|
// instead.
|
||||||
|
void queueAppSignal(AppSignal signal) { app_signals_ << signal; }
|
||||||
|
// Flush queued app signals. Should be called from the main window after
|
||||||
|
// each dialog that calls queueAppSignal closes.
|
||||||
|
void flushAppSignals();
|
||||||
void emitStatCommandSignal(const QString &menu_path, const char *arg, void *userdata);
|
void emitStatCommandSignal(const QString &menu_path, const char *arg, void *userdata);
|
||||||
void emitTapParameterSignal(const QString cfg_abbr, const QString arg, void *userdata);
|
void emitTapParameterSignal(const QString cfg_abbr, const QString arg, void *userdata);
|
||||||
void addDynamicMenuGroupItem(int group, QAction *sg_action);
|
void addDynamicMenuGroupItem(int group, QAction *sg_action);
|
||||||
|
@ -121,6 +128,7 @@ private:
|
||||||
QIcon normal_icon_;
|
QIcon normal_icon_;
|
||||||
QIcon capture_icon_;
|
QIcon capture_icon_;
|
||||||
static QString window_title_separator_;
|
static QString window_title_separator_;
|
||||||
|
QList<AppSignal> app_signals_;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent *event);
|
bool event(QEvent *event);
|
||||||
|
|
Loading…
Reference in New Issue