aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2020-04-27 22:46:02 +0200
committerAnders Broman <a.broman58@gmail.com>2020-04-29 03:35:44 +0000
commit7bd3f8a58f8512232288c5390ed3ca367d6ed7c7 (patch)
treea2ceab62e12321645ff7e522ff99f2b3495c3967 /ui
parent80252503132e93d3cb615e667a74e20854f78f20 (diff)
LteMacStatisticsDialog: fix memory leaks
Remember the delegates that we use and free them explicitly in the destructor. Change-Id: Iba07c3e9952dc152d94468b6b7c7e2c2a74c1f65 Reviewed-on: https://code.wireshark.org/review/36965 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/lte_mac_statistics_dialog.cpp8
-rw-r--r--ui/qt/lte_mac_statistics_dialog.h2
2 files changed, 8 insertions, 2 deletions
diff --git a/ui/qt/lte_mac_statistics_dialog.cpp b/ui/qt/lte_mac_statistics_dialog.cpp
index ef724b522e..06964a8ace 100644
--- a/ui/qt/lte_mac_statistics_dialog.cpp
+++ b/ui/qt/lte_mac_statistics_dialog.cpp
@@ -536,8 +536,10 @@ LteMacStatisticsDialog::LteMacStatisticsDialog(QWidget &parent, CaptureFile &cf,
// Will set whole-UE headings originally.
updateHeaderLabels();
- statsTreeWidget()->setItemDelegateForColumn(col_ul_padding_percent_, new PercentBarDelegate());
- statsTreeWidget()->setItemDelegateForColumn(col_dl_padding_percent_, new PercentBarDelegate());
+ ul_delegate_ = new PercentBarDelegate();
+ statsTreeWidget()->setItemDelegateForColumn(col_ul_padding_percent_, ul_delegate_);
+ dl_delegate_ = new PercentBarDelegate();
+ statsTreeWidget()->setItemDelegateForColumn(col_dl_padding_percent_, dl_delegate_);
statsTreeWidget()->sortByColumn(col_rnti_, Qt::AscendingOrder);
@@ -608,6 +610,8 @@ LteMacStatisticsDialog::LteMacStatisticsDialog(QWidget &parent, CaptureFile &cf,
// Destructor.
LteMacStatisticsDialog::~LteMacStatisticsDialog()
{
+ delete ul_delegate_;
+ delete dl_delegate_;
}
// Update system/common counters, and redraw if changed.
diff --git a/ui/qt/lte_mac_statistics_dialog.h b/ui/qt/lte_mac_statistics_dialog.h
index 79f79306e4..6d11873d3e 100644
--- a/ui/qt/lte_mac_statistics_dialog.h
+++ b/ui/qt/lte_mac_statistics_dialog.h
@@ -15,6 +15,7 @@
#include <QLabel>
#include <QCheckBox>
+#include <ui/qt/models/percent_bar_delegate.h>
// Common channel stats
typedef struct mac_lte_common_stats {
@@ -48,6 +49,7 @@ private:
QLabel *commonStatsLabel_;
QCheckBox *showSRFilterCheckBox_;
QCheckBox *showRACHFilterCheckBox_;
+ PercentBarDelegate *ul_delegate_, *dl_delegate_;
QString displayFilter_;
// Callbacks for register_tap_listener