diff options
author | Peter Wu <peter@lekensteyn.nl> | 2017-01-11 00:33:46 +0100 |
---|---|---|
committer | Roland Knall <rknall@gmail.com> | 2017-01-12 13:41:09 +0000 |
commit | f8dc2346dfa5df67749583a428f9a76b2f61acb1 (patch) | |
tree | 441a4d5565bb46e01cca7e83cf5fe183830d5a8b /ui/qt/interface_tree_model.cpp | |
parent | 4b3b3f587726bf055c252b4497d10375c08b5993 (diff) | |
download | wireshark-f8dc2346dfa5df67749583a428f9a76b2f61acb1.tar.gz |
Qt: fix memleak of PointList in interface statistics
The list of points (for interface traffic statistics) is part of the
interface tree model/view. Remove the pointer indirection to simplify
cleanup and avoid leaking a PointList.
Note that the SparkLineDelegate is used in two different places
(CaptureInterfacesDialog and InterfaceTreeModel).
Change-Id: I5fef7dadd44fdf58c07844fee269f509c712a36f
Reviewed-on: https://code.wireshark.org/review/19606
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui/qt/interface_tree_model.cpp')
-rw-r--r-- | ui/qt/interface_tree_model.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/ui/qt/interface_tree_model.cpp b/ui/qt/interface_tree_model.cpp index d55ff7ffe4..78d02b002a 100644 --- a/ui/qt/interface_tree_model.cpp +++ b/ui/qt/interface_tree_model.cpp @@ -338,12 +338,6 @@ void InterfaceTreeModel::interfaceListChanged() { emit beginResetModel(); - QMap<QString, PointList *>::const_iterator it = points.constBegin(); - while(it != points.constEnd()) - { - it.value()->clear(); - ++it; - } points.clear(); emit endResetModel(); @@ -435,9 +429,6 @@ void InterfaceTreeModel::updateStatistic(unsigned int idx) struct pcap_stat stats; - if ( !points.contains(device.name) ) - points.insert(device.name, new PointList()); - diff = 0; if ( capture_stats(stat_cache_, device.name, &stats) ) { @@ -452,7 +443,7 @@ void InterfaceTreeModel::updateStatistic(unsigned int idx) g_array_insert_val(global_capture_opts.all_ifaces, idx, device); } - points[device.name]->append(diff); + points[device.name].append(diff); emit dataChanged(index(idx, IFTREE_COL_STATS), index(idx, IFTREE_COL_STATS)); #else Q_UNUSED(idx); @@ -467,7 +458,7 @@ void InterfaceTreeModel::getPoints(int idx, PointList *pts) interface_t device = g_array_index(global_capture_opts.all_ifaces, interface_t, idx); if ( points.contains(device.name) ) - pts->append(*points[device.name]); + pts->append(points[device.name]); #else Q_UNUSED(idx); Q_UNUSED(pts); |