diff options
author | João Barbosa <joao.paulo.barbosa@gmail.com> | 2019-11-16 23:41:16 +0000 |
---|---|---|
committer | João Barbosa <joao.paulo.barbosa@gmail.com> | 2020-05-04 12:05:42 +0100 |
commit | e8123eae40eb264bbb71007d0eb074901f0e2fe5 (patch) | |
tree | 58dd570d96e09cc52db69497e9541f67416e6656 /src | |
parent | afa577c323dcaedf641897fab43af2540e230bcb (diff) |
gui: Fix itemWalletAddress leak when not tree mode
Diffstat (limited to 'src')
-rw-r--r-- | src/qt/coincontroldialog.cpp | 5 | ||||
-rw-r--r-- | src/qt/coincontroldialog.h | 1 |
2 files changed, 2 insertions, 4 deletions
diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index b46f416b6c..af7940cd29 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -606,8 +606,7 @@ void CoinControlDialog::updateView() int nDisplayUnit = model->getOptionsModel()->getDisplayUnit(); for (const auto& coins : model->wallet().listCoins()) { - CCoinControlWidgetItem *itemWalletAddress = new CCoinControlWidgetItem(); - itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked); + CCoinControlWidgetItem* itemWalletAddress{nullptr}; QString sWalletAddress = QString::fromStdString(EncodeDestination(coins.first)); QString sWalletLabel = model->getAddressTableModel()->labelForAddress(sWalletAddress); if (sWalletLabel.isEmpty()) @@ -616,7 +615,7 @@ void CoinControlDialog::updateView() if (treeMode) { // wallet address - ui->treeWidget->addTopLevelItem(itemWalletAddress); + itemWalletAddress = new CCoinControlWidgetItem(ui->treeWidget); itemWalletAddress->setFlags(flgTristate); itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked); diff --git a/src/qt/coincontroldialog.h b/src/qt/coincontroldialog.h index efc06a7656..fcf34356f1 100644 --- a/src/qt/coincontroldialog.h +++ b/src/qt/coincontroldialog.h @@ -31,7 +31,6 @@ class CCoinControlWidgetItem : public QTreeWidgetItem { public: explicit CCoinControlWidgetItem(QTreeWidget *parent, int type = Type) : QTreeWidgetItem(parent, type) {} - explicit CCoinControlWidgetItem(int type = Type) : QTreeWidgetItem(type) {} explicit CCoinControlWidgetItem(QTreeWidgetItem *parent, int type = Type) : QTreeWidgetItem(parent, type) {} bool operator<(const QTreeWidgetItem &other) const; |