aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2017-11-11 03:25:36 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2017-11-11 08:59:28 +0000
commitbce5b50f734bfd63b29ce44bfce29cb2d0d094b9 (patch)
tree1d21c19bc39761c531b3480d80f26589cc4ccacd /ui
parent7cbbbe0bde475786d661fe887ee2340a269f1063 (diff)
Qt: Fix use-after-free crashes when changing packets
QTabWidget::clear() is documented to remove all tabs without deleting them. As a result, findByteViewTextForTvb will still find ByteViewText children with freed tvbs. Fix this by deleting the tabs too. Change-Id: I5b4fdc7154a3804e3bd5f360749e95d178ffe580 Bug: 14199 Fixes: v2.5.0rc0-1532-g56a130a152 ("ByteViewText: Remove epan dependancy") Reviewed-on: https://code.wireshark.org/review/24339 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/byte_view_tab.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/ui/qt/byte_view_tab.cpp b/ui/qt/byte_view_tab.cpp
index 9b9c08cdcc..d5018d0f98 100644
--- a/ui/qt/byte_view_tab.cpp
+++ b/ui/qt/byte_view_tab.cpp
@@ -102,7 +102,9 @@ void ByteViewTab::packetSelectionChanged()
if ( ! cap_file_ || ! cap_file_->edt )
return;
+ // Remove tabs (as these refer to stale tvbs) and free resources.
clear();
+ qDeleteAll(findChildren<ByteViewText *>());
GSList *src_le;
for (src_le = cap_file_->edt->pi.data_src; src_le != NULL; src_le = src_le->next) {