Qt: Always rebuild columns when fields changed

The columns must be recreated even if no capture file is loaded
because custom columns may have reference to deregistered fields.

Change-Id: I4ed7345b3200e5af211695f1a6511ee229d5f13c
Reviewed-on: https://code.wireshark.org/review/10076
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
This commit is contained in:
Stig Bjørlykke 2015-08-17 21:39:41 +02:00
parent 0368b827c9
commit 68c51724fe
3 changed files with 12 additions and 8 deletions

View File

@ -1306,7 +1306,6 @@ void MainWindow::redissectPackets()
void MainWindow::fieldsChanged()
{
// Reload color filters
color_filters_reload();
// Syntax check filter
@ -1325,8 +1324,8 @@ void MainWindow::fieldsChanged()
}
if (have_custom_cols(&CaptureFile::globalCapFile()->cinfo)) {
// Recreate packet list according to new/changed/deleted fields
packet_list_->columnsChanged();
// Recreate packet list columns according to new/changed/deleted fields
packet_list_->fieldsChanged(CaptureFile::globalCapFile());
}
}
@ -2487,11 +2486,7 @@ void MainWindow::on_actionAnalyzeReloadLuaPlugins_triggered()
(void) wsApp->readConfigurationFiles(&gdp_path, &dp_path);
fieldsChanged();
if (CaptureFile::globalCapFile()->state != FILE_CLOSED) {
// Redissect packets if we have any
redissectPackets();
}
redissectPackets();
wsApp->setReloadingLua(false);
SimpleDialog::displayQueuedMessages();

View File

@ -642,6 +642,14 @@ void PacketList::columnsChanged()
redrawVisiblePackets();
}
// Fields have changed, update custom columns
void PacketList::fieldsChanged(capture_file *cf)
{
prefs.num_cols = g_list_length(prefs.col_list);
col_cleanup(&cf->cinfo);
build_column_format_array(&cf->cinfo, prefs.num_cols, FALSE);
}
// Column widths should
// - Load from recent when we load a new profile (including at starting up).
// - Persist across freezes and thaws.

View File

@ -148,6 +148,7 @@ public slots:
void unsetAllTimeReferences();
void redrawVisiblePackets();
void columnsChanged();
void fieldsChanged(capture_file *cf);
void applyRecentColumnWidths();
void elideModeChanged();