From 062e5b3118de4c4658f4379d3e84f273e3976a97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Mon, 16 Nov 2015 21:33:17 +0100 Subject: [PATCH] Qt: setMenusForSelectedPacket when capture file is closed. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moved setMenusForSelectedPacket() to captureFileClosed() because capture_file_.capFile() is still valid in captureFileClosing(). Menu items depending on is_ip, is_tcp, is_udp, is_sctp, is_ssl, is_rtp and is_lte_rlc must be disabled when closing the capture file because many of the dialogs does crash when launched without a valid frame selected. All dialogs should probably have a guard for this to avoid crashes, but that may be an exercise for an enhancement to add support for the dialogs to follow the current loaded capture file. Change-Id: If5837a355d08df76547572a25d46ffa539070de3 Reviewed-on: https://code.wireshark.org/review/11883 Petri-Dish: Stig Bjørlykke Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke --- ui/qt/main_window_slots.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index 9c5d386759..672ef9cfbb 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -698,7 +698,6 @@ void MainWindow::captureFileRetapFinished() void MainWindow::captureFileClosing() { setMenusForCaptureFile(true); setForCapturedPackets(false); - setMenusForSelectedPacket(); setForCaptureInProgress(false); // Reset expert information indicator @@ -722,6 +721,7 @@ void MainWindow::captureFileClosed() { main_ui_->statusBar->popFileStatus(); setTitlebarForSelectedTreeRow(); + setMenusForSelectedPacket(); setMenusForSelectedTreeRow(); if (!global_capture_opts.multi_files_on) @@ -1127,7 +1127,7 @@ void MainWindow::setMenusForSelectedPacket() bool enable = false; QString filter; - if (capture_file_.capFile()->edt) { + if (capture_file_.capFile() && capture_file_.capFile()->edt) { enable = conv_filter->is_filter_valid(&capture_file_.capFile()->edt->pi); filter = gchar_free_to_qstring(conv_filter->build_filter_string(&capture_file_.capFile()->edt->pi)); }