Qt: Invalidate the idle dissection timer when clearing packet list

When clearing the packet list model (called eventually from closing
the capturing file or redissecting), mark the idle dissection timer
as invalid so that idle dissection stops. It will be started again
by PacketList::captureFileReadFinished()

This saves some CPU during what is a fairly intensive and not
actually idle time, computing information that might be invalid.

In particular, this can prevent some read failures and spurious pop-up
error messages when opening a large file and saving it to a different
format (so that it is closed, and rescanned for new packet offsets)
while idle dissection is still ongoing. The idle dissection can
attempt to read packets with the wrong offsets. The error is caught
without serious issues, but messages like "pcap: file has X-byte
packet, bigger than maximum of Y" would imply to a user that something
went wrong with saving the file in the new format.

Related to #19486
This commit is contained in:
John Thacker 2023-11-29 23:25:34 -05:00
parent 5256414290
commit 6409a42f4b
1 changed files with 1 additions and 0 deletions

View File

@ -180,6 +180,7 @@ void PacketListModel::clear() {
endResetModel();
max_row_height_ = 0;
max_line_count_ = 1;
idle_dissection_timer_->invalidate();
idle_dissection_row_ = 0;
}