Close packet dialogs when reload Lua plugins.

We could keep the dialogs with the current content if postponing
proto_free_deregistered_fields() until all dialogs are closed.
This would give a feature where the user is able to compare packets
before and after a reload.

Or we could add functions in PacketDialog to reload the packet details
in all open dialogs.  This would give a feature to always have a
updated dialog for all interesting packets.

Change-Id: I805352b65844eafafafc54cd61f08b4605416e64
Reviewed-on: https://code.wireshark.org/review/10201
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
This commit is contained in:
Stig Bjørlykke 2015-08-22 22:59:42 +02:00
parent 25ec198dd4
commit 7176958357
4 changed files with 36 additions and 0 deletions

View File

@ -138,6 +138,7 @@ private:
QActionGroup *time_display_actions_;
QActionGroup *time_precision_actions_;
FunnelStatistics *funnel_statistics_;
QList<QDialog *> packet_dialogs_;
bool capture_stopping_;
bool capture_filter_valid_;
@ -239,6 +240,7 @@ public slots:
void captureFileSaveStarted(const QString &file_path);
void filterExpressionsChanged();
void packetDialogClosed(QDialog *);
private slots:
// Manually connected slots (no "on_<object>_<signal>").
@ -387,6 +389,7 @@ private slots:
void on_actionViewResizeColumns_triggered();
void openPacketDialog(bool from_reference = false);
void closePacketDialogs();
void on_actionViewShowPacketInNewWindow_triggered();
void on_actionContextShowLinkedPacketInNewWindow_triggered();
void on_actionViewReload_triggered();

View File

@ -2294,12 +2294,28 @@ void MainWindow::openPacketDialog(bool from_reference)
connect(this, SIGNAL(monospaceFontChanged(QFont)),
packet_dialog, SIGNAL(monospaceFontChanged(QFont)));
connect(packet_dialog, SIGNAL(packetDialogClosed(QDialog *)),
this, SLOT(packetDialogClosed(QDialog *)));
zoomText(); // Emits monospaceFontChanged
packet_dialogs_.append(packet_dialog);
packet_dialog->show();
}
}
void MainWindow::closePacketDialogs()
{
QList<QDialog *> packet_dialogs_copy(packet_dialogs_);
foreach(QDialog *packet_dialog, packet_dialogs_copy) {
packet_dialog->close();
}
}
void MainWindow::packetDialogClosed(QDialog *packet_dialog)
{
packet_dialogs_.removeOne(packet_dialog);
}
void MainWindow::on_actionViewShowPacketInNewWindow_triggered()
{
openPacketDialog();
@ -2489,6 +2505,7 @@ void MainWindow::on_actionAnalyzeReloadLuaPlugins_triggered()
wslua_reload_plugins(NULL, NULL);
funnel_statistics_reload_menus();
reloadDynamicMenus();
closePacketDialogs();
// Preferences may have been deleted so close all widgets using prefs
proto_tree_->closeContextMenu();

View File

@ -120,6 +120,18 @@ PacketDialog::~PacketDialog()
g_free(packet_data_);
}
void PacketDialog::accept()
{
emit packetDialogClosed(this);
WiresharkDialog::accept();
}
void PacketDialog::reject()
{
emit packetDialogClosed(this);
WiresharkDialog::reject();
}
void PacketDialog::captureFileClosing()
{
delete byte_view_tab_;

View File

@ -44,6 +44,7 @@ public:
signals:
void monospaceFontChanged(QFont);
void packetDialogClosed(QDialog *);
private slots:
void captureFileClosing();
@ -52,6 +53,9 @@ private slots:
void on_buttonBox_helpRequested();
private:
void accept();
void reject();
Ui::PacketDialog *ui;
QString col_info_;