mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-13 11:25:02 -05:00
Merge #18578: gui: Fix leak in CoinControlDialog::updateView
e8123eae40
gui: Fix itemWalletAddress leak when not tree mode (João Barbosa) Pull request description: Taken from #17457, the first commit is a similar to88a94f7bb8
but for test binary, and the second commit fixes a leak where `CCoinControlWidgetItem` are unnecessarily created and leaked. ACKs for top commit: jonasschnelli: utACKe8123eae40
hebasto: ACKe8123eae40
, tested on Linux Mint 19.3. Tree-SHA512: 8b43cb29de103842ce5f048de51222919540d3212d2873c16731145e856178644041924ad0e9a58c2ff08f209a9b4ac26dc9965289eb719da233c0984f93631e
This commit is contained in:
commit
8d17f8dc17
2 changed files with 2 additions and 4 deletions
|
@ -606,8 +606,7 @@ void CoinControlDialog::updateView()
|
||||||
int nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
|
int nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
|
||||||
|
|
||||||
for (const auto& coins : model->wallet().listCoins()) {
|
for (const auto& coins : model->wallet().listCoins()) {
|
||||||
CCoinControlWidgetItem *itemWalletAddress = new CCoinControlWidgetItem();
|
CCoinControlWidgetItem* itemWalletAddress{nullptr};
|
||||||
itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
|
|
||||||
QString sWalletAddress = QString::fromStdString(EncodeDestination(coins.first));
|
QString sWalletAddress = QString::fromStdString(EncodeDestination(coins.first));
|
||||||
QString sWalletLabel = model->getAddressTableModel()->labelForAddress(sWalletAddress);
|
QString sWalletLabel = model->getAddressTableModel()->labelForAddress(sWalletAddress);
|
||||||
if (sWalletLabel.isEmpty())
|
if (sWalletLabel.isEmpty())
|
||||||
|
@ -616,7 +615,7 @@ void CoinControlDialog::updateView()
|
||||||
if (treeMode)
|
if (treeMode)
|
||||||
{
|
{
|
||||||
// wallet address
|
// wallet address
|
||||||
ui->treeWidget->addTopLevelItem(itemWalletAddress);
|
itemWalletAddress = new CCoinControlWidgetItem(ui->treeWidget);
|
||||||
|
|
||||||
itemWalletAddress->setFlags(flgTristate);
|
itemWalletAddress->setFlags(flgTristate);
|
||||||
itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
|
itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
|
||||||
|
|
|
@ -31,7 +31,6 @@ class CCoinControlWidgetItem : public QTreeWidgetItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CCoinControlWidgetItem(QTreeWidget *parent, int type = Type) : QTreeWidgetItem(parent, type) {}
|
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) {}
|
explicit CCoinControlWidgetItem(QTreeWidgetItem *parent, int type = Type) : QTreeWidgetItem(parent, type) {}
|
||||||
|
|
||||||
bool operator<(const QTreeWidgetItem &other) const override;
|
bool operator<(const QTreeWidgetItem &other) const override;
|
||||||
|
|
Loading…
Add table
Reference in a new issue