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.
This commit is contained in:
John Thacker 2023-02-15 21:42:30 -05:00
parent 5c0af364f1
commit f6e6853dc4
2 changed files with 4 additions and 3 deletions

View File

@ -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);

View File

@ -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);