forked from osmocom/wireshark
ProfileTreeView: fix a memory leak
In the constructor, we allocate a delegate for the name column and assign it by calling QAbstractItemView::setItemDelegateForColumn(). This does not pass ownership of the delegate to QAbstractItemView, it's still up to us to free the delegate. ASAN warns about this Indirect leak of 48 byte(s) in 1 object(s) allocated from: ... #1 ... in ProfileTreeView::ProfileTreeView(QWidget*) ui/qt/widgets/profile_tree_view.cpp:46:17 #2 ... in Ui_ProfileDialog::setupUi(QDialog*) ui/qt/qtui_autogen/include/ui_profile_dialog.h:67:31 #3 ... in ProfileDialog::ProfileDialog(QWidget*) ui/qt/profile_dialog.cpp:59:13 #4 ... in MainWindow::on_actionEditConfigurationProfiles_triggered() ui/qt/main_window_slots.cpp:2239:36 Add a destructor for ProfileTreeView and free the delegate there. Change-Id: I2a76abb7ec174c91ad15bfac91f2b47bea29f511 Reviewed-on: https://code.wireshark.org/review/36934 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>
This commit is contained in:
parent
3485ad6d1c
commit
d8137cc1be
|
@ -50,6 +50,11 @@ ProfileTreeView::ProfileTreeView(QWidget *parent) :
|
|||
connect(delegate_, SIGNAL(commitData(QWidget *)), this, SIGNAL(itemUpdated()));
|
||||
}
|
||||
|
||||
ProfileTreeView::~ProfileTreeView()
|
||||
{
|
||||
delete delegate_;
|
||||
}
|
||||
|
||||
void ProfileTreeView::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
|
||||
{
|
||||
QTreeView::selectionChanged(selected, deselected);
|
||||
|
|
|
@ -44,6 +44,7 @@ class ProfileTreeView : public QTreeView
|
|||
Q_OBJECT
|
||||
public:
|
||||
ProfileTreeView(QWidget *parent = nullptr);
|
||||
~ProfileTreeView();
|
||||
|
||||
void selectRow(int row);
|
||||
bool activeEdit();
|
||||
|
|
Loading…
Reference in New Issue