mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-08 19:53:27 +01:00
qt: Plug many memory leaks
None of these are very serious, and are leaks in objects that are created at most one time. In most cases this means properly using the QObject parent hierarchy, except for BanTablePriv/PeerTablePriv which are not QObject, so use a std::unique_ptr instead.
This commit is contained in:
@@ -25,8 +25,8 @@ class TxViewDelegate : public QAbstractItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TxViewDelegate(const PlatformStyle *_platformStyle):
|
||||
QAbstractItemDelegate(), unit(BitcoinUnits::BTC),
|
||||
TxViewDelegate(const PlatformStyle *_platformStyle, QObject *parent=nullptr):
|
||||
QAbstractItemDelegate(parent), unit(BitcoinUnits::BTC),
|
||||
platformStyle(_platformStyle)
|
||||
{
|
||||
|
||||
@@ -119,8 +119,7 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent)
|
||||
currentWatchOnlyBalance(-1),
|
||||
currentWatchUnconfBalance(-1),
|
||||
currentWatchImmatureBalance(-1),
|
||||
txdelegate(new TxViewDelegate(platformStyle)),
|
||||
filter(0)
|
||||
txdelegate(new TxViewDelegate(platformStyle, this))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@@ -220,7 +219,7 @@ void OverviewPage::setWalletModel(WalletModel *model)
|
||||
if(model && model->getOptionsModel())
|
||||
{
|
||||
// Set up transaction list
|
||||
filter = new TransactionFilterProxy();
|
||||
filter.reset(new TransactionFilterProxy());
|
||||
filter->setSourceModel(model->getTransactionTableModel());
|
||||
filter->setLimit(NUM_ITEMS);
|
||||
filter->setDynamicSortFilter(true);
|
||||
@@ -228,7 +227,7 @@ void OverviewPage::setWalletModel(WalletModel *model)
|
||||
filter->setShowInactive(false);
|
||||
filter->sort(TransactionTableModel::Date, Qt::DescendingOrder);
|
||||
|
||||
ui->listTransactions->setModel(filter);
|
||||
ui->listTransactions->setModel(filter.get());
|
||||
ui->listTransactions->setModelColumn(TransactionTableModel::ToAddress);
|
||||
|
||||
// Keep up to date with wallet
|
||||
|
||||
Reference in New Issue
Block a user