forked from osmocom/wireshark
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:
parent
5c0af364f1
commit
f6e6853dc4
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue