Qt: Restore column visibility when loading packets

Always restore column visibility when loading packets to avoid some
situations where the column hidden state was incorrect.

This fixes the following scenario:
 - Apply a column and hide it using the column popup menu
 - Apply another column and remove it using the column popup menu
 - Close and reopen the capture file
 - Observe the hidden column is shown, but with wrong width

Change-Id: I00531907b2383c6605a2d62e8243092906037d0c
Reviewed-on: https://code.wireshark.org/review/29516
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
This commit is contained in:
Stig Bjørlykke 2018-09-09 20:30:54 +02:00
parent 7ce18dc465
commit 7d7175a130
1 changed files with 8 additions and 6 deletions

View File

@ -1198,13 +1198,15 @@ void PacketList::deleteAllPacketComments()
void PacketList::setCaptureFile(capture_file *cf)
{
if (cf) {
// We're opening. Restore our column widths.
header()->restoreState(column_state_);
}
cap_file_ = cf;
if (cap_file_ && columns_changed_) {
columnsChanged();
if (cf) {
if (columns_changed_) {
columnsChanged();
} else {
// Restore columns widths and visibility.
header()->restoreState(column_state_);
setColumnVisibility();
}
}
packet_list_model_->setCaptureFile(cf);
create_near_overlay_ = true;