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);
|
||||
}
|
||||
|
||||
wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
|
||||
wsApp->queueAppSignal(WiresharkApplication::PacketDissectionChanged);
|
||||
}
|
||||
|
||||
void DecodeAsDialog::on_buttonBox_clicked(QAbstractButton *button)
|
||||
|
|
|
@ -46,6 +46,7 @@ enum
|
|||
heuristic_type_ = 1002
|
||||
};
|
||||
|
||||
#include <QDebug>
|
||||
class EnableProtocolTreeWidgetItem : public QTreeWidgetItem
|
||||
{
|
||||
public:
|
||||
|
@ -245,11 +246,11 @@ bool EnabledProtocolsDialog::applyChanges()
|
|||
|
||||
if ((*it)->checkState(PROTOCOL_COLUMN) == Qt::Checked)
|
||||
{
|
||||
redissect |= it_cast->applyValue(TRUE);
|
||||
redissect |= it_cast->applyValue(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
redissect |= it_cast->applyValue(FALSE);
|
||||
redissect |= it_cast->applyValue(false);
|
||||
}
|
||||
++it;
|
||||
}
|
||||
|
@ -311,10 +312,13 @@ void EnabledProtocolsDialog::on_buttonBox_accepted()
|
|||
if (applyChanges())
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (button == ui->buttonBox->button(QDialogButtonBox::Apply))
|
||||
|
@ -328,8 +332,8 @@ void EnabledProtocolsDialog::on_buttonBox_clicked(QAbstractButton *button)
|
|||
wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
void EnabledProtocolsDialog::on_buttonBox_helpRequested()
|
||||
{
|
||||
|
|
|
@ -47,7 +47,9 @@ private slots:
|
|||
void on_disable_all_button__clicked();
|
||||
void on_search_line_edit__textChanged(const QString &search_re);
|
||||
void on_buttonBox_accepted();
|
||||
#if 0
|
||||
void on_buttonBox_clicked(QAbstractButton *button);
|
||||
#endif
|
||||
void on_buttonBox_helpRequested();
|
||||
|
||||
private:
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<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>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -2604,7 +2604,7 @@
|
|||
</action>
|
||||
<action name="actionAnalyzeEnabledProtocols">
|
||||
<property name="text">
|
||||
<string>Enable Protocols…</string>
|
||||
<string>Enabled Protocols…</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Enable and disable specific protocols</string>
|
||||
|
|
|
@ -1972,11 +1972,9 @@ void MainWindow::showPreferencesDialog(PreferencesDialog::PreferencesPane start_
|
|||
pref_dialog.setPane(start_pane);
|
||||
pref_dialog.exec();
|
||||
|
||||
// Emitting PacketDissectionChanged directly from PreferencesDialog
|
||||
// can cause problems. Queue them up and emit them here.
|
||||
foreach (WiresharkApplication::AppSignal app_signal, pref_dialog.appSignals()) {
|
||||
wsApp->emitAppSignal(app_signal);
|
||||
}
|
||||
// Emitting PacketDissectionChanged directly from a QDialog can cause
|
||||
// problems on OS X.
|
||||
wsApp->flushAppSignals();
|
||||
}
|
||||
|
||||
void MainWindow::showPreferencesDialog(QString module_name)
|
||||
|
@ -1986,11 +1984,9 @@ void MainWindow::showPreferencesDialog(QString module_name)
|
|||
pref_dialog.setPane(module_name);
|
||||
pref_dialog.exec();
|
||||
|
||||
// Emitting PacketDissectionChanged directly from PreferencesDialog
|
||||
// can cause problems. Queue them up and emit them here.
|
||||
foreach (WiresharkApplication::AppSignal app_signal, pref_dialog.appSignals()) {
|
||||
wsApp->emitAppSignal(app_signal);
|
||||
}
|
||||
// Emitting PacketDissectionChanged directly from a QDialog can cause
|
||||
// problems on OS X.
|
||||
wsApp->flushAppSignals();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionEditPreferences_triggered()
|
||||
|
@ -2369,6 +2365,9 @@ void MainWindow::on_actionAnalyzeDisplayFilterMacros_triggered()
|
|||
UatDialog uat_dlg(parentWidget(), dfm_uat);
|
||||
|
||||
uat_dlg.exec();
|
||||
// Emitting PacketDissectionChanged directly from a QDialog can cause
|
||||
// problems on OS X.
|
||||
wsApp->flushAppSignals();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionAnalyzeCreateAColumn_triggered()
|
||||
|
@ -2466,6 +2465,10 @@ void MainWindow::on_actionAnalyzeEnabledProtocols_triggered()
|
|||
{
|
||||
EnabledProtocolsDialog enable_proto_dialog(this);
|
||||
enable_proto_dialog.exec();
|
||||
|
||||
// Emitting PacketDissectionChanged directly from a QDialog can cause
|
||||
// problems on OS X.
|
||||
wsApp->flushAppSignals();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionAnalyzeDecodeAs_triggered()
|
||||
|
@ -2480,6 +2483,10 @@ void MainWindow::on_actionAnalyzeDecodeAs_triggered()
|
|||
connect(this, SIGNAL(setCaptureFile(capture_file*)),
|
||||
&da_dialog, SLOT(setCaptureFile(capture_file*)));
|
||||
da_dialog.exec();
|
||||
|
||||
// Emitting PacketDissectionChanged directly from a QDialog can cause
|
||||
// problems on OS X.
|
||||
wsApp->flushAppSignals();
|
||||
}
|
||||
|
||||
#ifdef HAVE_LUA
|
||||
|
|
|
@ -842,14 +842,11 @@ void PreferencesDialog::on_buttonBox_accepted()
|
|||
|
||||
wsApp->setMonospaceFont(prefs.gui_qt_font_name);
|
||||
|
||||
/* Now destroy the "Preferences" dialog. */
|
||||
// window_destroy(GTK_WIDGET(parent_w));
|
||||
|
||||
if (must_redissect) {
|
||||
/* 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()
|
||||
|
|
|
@ -64,8 +64,6 @@ public:
|
|||
void setPane(PreferencesPane start_pane);
|
||||
void setPane(const QString module_name);
|
||||
|
||||
const QList<WiresharkApplication::AppSignal> appSignals() const { return app_signals_; }
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *evt);
|
||||
void keyPressEvent(QKeyEvent *evt);
|
||||
|
@ -81,7 +79,6 @@ private:
|
|||
QString saved_string_pref_;
|
||||
QComboBox *cur_combo_box_;
|
||||
int saved_combo_idx_;
|
||||
QList<WiresharkApplication::AppSignal> app_signals_;
|
||||
|
||||
private slots:
|
||||
void on_prefsTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
||||
|
|
|
@ -101,6 +101,9 @@ public:
|
|||
void showUatDialog() {
|
||||
UatDialog uat_dlg(parentWidget(), pref_->varp.uat);
|
||||
uat_dlg.exec();
|
||||
// Emitting PacketDissectionChanged directly from a QDialog can cause
|
||||
// problems on OS X.
|
||||
wsApp->flushAppSignals();
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -289,6 +289,10 @@ void SCTPChunkStatisticsDialog::on_actionChunkTypePreferences_triggered()
|
|||
|
||||
UatDialog *uatdialog = new UatDialog(this, pref->varp.uat);
|
||||
uatdialog->exec();
|
||||
// Emitting PacketDissectionChanged directly from a QDialog can cause
|
||||
// problems on OS X.
|
||||
wsApp->flushAppSignals();
|
||||
|
||||
ui->tableWidget->clear();
|
||||
ui->tableWidget->setRowCount(0);
|
||||
ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(QString(tr("Association"))));
|
||||
|
|
|
@ -496,11 +496,11 @@ void UatDialog::applyChanges()
|
|||
|
||||
if (uat_->flags & UAT_AFFECTS_FIELDS) {
|
||||
/* Recreate list with new fields and redissect packets */
|
||||
wsApp->emitAppSignal(WiresharkApplication::FieldsChanged);
|
||||
wsApp->queueAppSignal(WiresharkApplication::FieldsChanged);
|
||||
}
|
||||
if (uat_->flags & UAT_AFFECTS_DISSECTION) {
|
||||
/* 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)
|
||||
{
|
||||
emit openStatCommandDialog(menu_path, arg, userdata);
|
||||
|
|
|
@ -72,6 +72,13 @@ public:
|
|||
|
||||
void registerUpdate(register_action_e action, const char *message);
|
||||
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 emitTapParameterSignal(const QString cfg_abbr, const QString arg, void *userdata);
|
||||
void addDynamicMenuGroupItem(int group, QAction *sg_action);
|
||||
|
@ -121,6 +128,7 @@ private:
|
|||
QIcon normal_icon_;
|
||||
QIcon capture_icon_;
|
||||
static QString window_title_separator_;
|
||||
QList<AppSignal> app_signals_;
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event);
|
||||
|
|
Loading…
Reference in New Issue