aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/capture_interfaces_dialog.cpp
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-12-11 11:41:07 +0100
committerAnders Broman <a.broman58@gmail.com>2015-12-16 05:43:58 +0000
commite3dd3f97f1f2afe18501adcfac9400ddc3e3c0a5 (patch)
treeef70643e6425cd26c1a6186292985966c3a16569 /ui/qt/capture_interfaces_dialog.cpp
parentfb0246c6fd7cd34b820558f75eb48bba6326b768 (diff)
Qt: fix memleaks related to interface dialog
Also fix a not-so-problematic recent files "leak" when quitting Wireshark. Change-Id: I8556b07c197f0934f93d6da8c573c47fbd3fc060 Reviewed-on: https://code.wireshark.org/review/12529 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/qt/capture_interfaces_dialog.cpp')
-rw-r--r--ui/qt/capture_interfaces_dialog.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/ui/qt/capture_interfaces_dialog.cpp b/ui/qt/capture_interfaces_dialog.cpp
index 949b2128d8..088e2a71d4 100644
--- a/ui/qt/capture_interfaces_dialog.cpp
+++ b/ui/qt/capture_interfaces_dialog.cpp
@@ -107,6 +107,7 @@ class InterfaceTreeWidgetItem : public QTreeWidgetItem
public:
InterfaceTreeWidgetItem(QTreeWidget *tree) : QTreeWidgetItem(tree) {}
bool operator< (const QTreeWidgetItem &other) const;
+ QList<int> points;
};
CaptureInterfacesDialog::CaptureInterfacesDialog(QWidget *parent) :
@@ -459,8 +460,6 @@ void CaptureInterfacesDialog::updateInterfaces()
interface_t *device;
for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) {
- QList<int> *points;
-
device = &g_array_index(global_capture_opts.all_ifaces, interface_t, i);
/* Continue if capture device is hidden */
@@ -470,10 +469,9 @@ void CaptureInterfacesDialog::updateInterfaces()
deviceMap[ui->interfaceTree->topLevelItemCount()] = i;
// Traffic sparklines
- points = new QList<int>();
InterfaceTreeWidgetItem *ti = new InterfaceTreeWidgetItem(ui->interfaceTree);
ti->setFlags(ti->flags() | Qt::ItemIsEditable);
- ti->setData(col_traffic_, Qt::UserRole, qVariantFromValue(points));
+ ti->setData(col_traffic_, Qt::UserRole, qVariantFromValue(&ti->points));
ti->setText(col_interface_, device->display_name);
if (device->no_addresses > 0) {