aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorJohn Thacker <johnthacker@gmail.com>2023-02-15 21:42:30 -0500
committerJohn Thacker <johnthacker@gmail.com>2023-02-19 12:10:44 +0000
commitf6e6853dc4c876109ca74fbb14e62ab5ee532d89 (patch)
treebe25a4f8a6fde7d91eaebcb9efcb81621e85f608 /ui
parent5c0af364f168e1cbdf3b27ff13d1457fa12ac6db (diff)
Qt: Plug leaks in Conversations/Endpoints windows
Set some models to have the Traffic Tab or Traffic Type List that creates them as parent, so that they will be deleted properly. Setting a model does not cause it to be deleted unless it is parented, because models can be shared among multiple views. Since these models are only used by the one view, parenting them is fine.
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/widgets/traffic_tab.cpp3
-rw-r--r--ui/qt/widgets/traffic_types_list.cpp4
2 files changed, 4 insertions, 3 deletions
diff --git a/ui/qt/widgets/traffic_tab.cpp b/ui/qt/widgets/traffic_tab.cpp
index 1fbc850d28..f4dcec0c43 100644
--- a/ui/qt/widgets/traffic_tab.cpp
+++ b/ui/qt/widgets/traffic_tab.cpp
@@ -123,6 +123,7 @@ QTreeView * TrafficTab::createTree(int protoId)
if (_createModel) {
ATapDataModel * model = _createModel(protoId, "");
+ model->setParent(tree);
connect(model, &ATapDataModel::tapListenerChanged, tree, &TrafficTree::tapListenerEnabled);
model->enableTap();
@@ -136,7 +137,7 @@ QTreeView * TrafficTab::createTree(int protoId)
}
}
- TrafficDataFilterProxy * proxyModel = new TrafficDataFilterProxy();
+ TrafficDataFilterProxy * proxyModel = new TrafficDataFilterProxy(tree);
proxyModel->setSourceModel(model);
tree->setModel(proxyModel);
diff --git a/ui/qt/widgets/traffic_types_list.cpp b/ui/qt/widgets/traffic_types_list.cpp
index ac8036abb9..0fe5feba93 100644
--- a/ui/qt/widgets/traffic_types_list.cpp
+++ b/ui/qt/widgets/traffic_types_list.cpp
@@ -239,9 +239,9 @@ void TrafficTypesList::setProtocolInfo(QString name, GList ** recentList)
{
_name = name;
- _sortModel = new TrafficListSortModel();
+ _sortModel = new TrafficListSortModel(this);
- _model = new TrafficTypesModel(recentList);
+ _model = new TrafficTypesModel(recentList, this);
_sortModel->setSourceModel(_model);
setModel(_sortModel);