diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2016-10-22 19:53:00 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-10-23 10:41:07 +0000 |
commit | 3576394ed4fc782ce5a2151c88c5a10b37cb3393 (patch) | |
tree | 2e2c9ce7f886af1c0da13b85a036b3b2db29a13c | |
parent | 892246acb02868ee4be14543521a20b9818184d6 (diff) |
interface_sort_filter_model: don't dereference a NULL pointer
This fixes a crash in InterfaceSortFilterModel::mapToSource().
sourceModel was set to match the sourceModel of the underlying
InterfaceFrame. When Wireshark is closed,
InterfaceSortFilterModel::mapToSource() is called after
InterfaceFrame was freed, the sourceModel is NULL in this case.
#0 0x000000000079a81e in InterfaceSortFilterModel::mapToSource
(this=0xe9fab0, proxyIndex=...)
/home/martin/src/wireshark.git/ui/qt/interface_sort_filter_model.cpp:250
...
#7 0x0000000000797ed9 in InterfaceTreeModel::~InterfaceTreeModel
(this=0xe9ff90, __in_chrg=<optimized out>)
at /home/martin/src/wireshark.git/ui/qt/interface_tree_model.cpp:72
#8 0x00000000006c4e20 in InterfaceFrame::~InterfaceFrame
(this=0xe643b0, __in_chrg=<optimized out>)
at /home/martin/src/wireshark.git/ui/qt/interface_frame.cpp:109
#9 0x00000000006c4ec9 in InterfaceFrame::~InterfaceFrame
(this=0xe643b0, __in_chrg=<optimized out>)
at /home/martin/src/wireshark.git/ui/qt/interface_frame.cpp:112
Change-Id: Ibe7f75ccd7a0af5f04febf967c47ada1a05bc3d3
Reviewed-on: https://code.wireshark.org/review/18411
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r-- | ui/qt/interface_sort_filter_model.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ui/qt/interface_sort_filter_model.cpp b/ui/qt/interface_sort_filter_model.cpp index e40329f5fc..73dde7b6a2 100644 --- a/ui/qt/interface_sort_filter_model.cpp +++ b/ui/qt/interface_sort_filter_model.cpp @@ -246,6 +246,9 @@ QModelIndex InterfaceSortFilterModel::mapToSource(const QModelIndex &proxyIndex) if ( ! proxyIndex.isValid() ) return QModelIndex(); + if ( ! sourceModel() ) + return QModelIndex(); + QModelIndex baseIndex = QSortFilterProxyModel::mapToSource(proxyIndex); QModelIndex newIndex = sourceModel()->index(baseIndex.row(), _columns.at(proxyIndex.column())); |