aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2018-03-31 19:03:10 +0200
committerRoland Knall <rknall@gmail.com>2018-04-09 04:08:10 +0000
commitf0fed342165145461ed88358d2fc8985d15f3745 (patch)
treefce0245143c3d8832b4bb198772ddd1a7759cf70 /ui/qt
parent55f6f6593cd168acf81f0a0de31e22ac59470bc4 (diff)
main window: don't keep a dangling freeze_focus_ pointer
Without this fix, Wireshark crashes when the user presses Ctrl-D or selects Edit / Ignore Packet and the current focus is somewhere on the bytes view. To ignore a packet, we protect the actual ignore operation by calling main window's freeze and thaw methods. We save a pointer freeze_focus_, pointing to the widget that has the focus, and restore the focus during thaw. This causes a crash if the focused widget is part of ByteViewTab. Ignoring the packet causes a redissection, the ByteViewTab and its children are cleared. freeze_focus_ remains non-NULL but doesn't point to a valid QWdiget any more. Calling freeze_focus_->setFocus() crashes. Fix this by using a QPointer<QWdiget> for freeze_focus_. The pointer is then reset to NULL when the QWdiget that it points to goes out of scope. Change-Id: Icc1f71a9de971284c628b7815a7fc1a5cc0d5fe2 Reviewed-on: https://code.wireshark.org/review/26693 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/main_window.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index 17197e0d33..9d1e056d99 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -31,6 +31,7 @@
#include <capchild/capture_session.h>
#include <QMainWindow>
+#include <QPointer>
#include <QSplitter>
#ifdef _WIN32
@@ -156,7 +157,7 @@ private:
QActionGroup *time_precision_actions_;
FunnelStatistics *funnel_statistics_;
QList<QPair<QAction *, bool> > freeze_actions_;
- QWidget *freeze_focus_;
+ QPointer<QWidget> freeze_focus_;
QMap<QAction *, ts_type> td_actions;
QMap<QAction *, ts_precision> tp_actions;
DragDropToolBar *filter_expression_toolbar_;