From 6ef2a8e21d14e30a2675714f5ee193168e58c068 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 4 Apr 2018 16:59:45 +0100 Subject: [PATCH] Wallet: fix listener leak --- src/libwalletqt/Wallet.cpp | 5 ++++- src/libwalletqt/Wallet.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp index 74649ce7..9bc267d8 100644 --- a/src/libwalletqt/Wallet.cpp +++ b/src/libwalletqt/Wallet.cpp @@ -863,7 +863,8 @@ Wallet::Wallet(Monero::Wallet *w, QObject *parent) m_history = new TransactionHistory(m_walletImpl->history(), this); m_addressBook = new AddressBook(m_walletImpl->addressBook(), this); m_subaddress = new Subaddress(m_walletImpl->subaddress(), this); - m_walletImpl->setListener(new WalletListenerImpl(this)); + m_walletListener = new WalletListenerImpl(this); + m_walletImpl->setListener(m_walletListener); m_connectionStatus = Wallet::ConnectionStatus_Disconnected; // start cache timers m_connectionStatusTime.restart(); @@ -896,5 +897,7 @@ Wallet::~Wallet() qDebug("Error storing wallet cache"); delete m_walletImpl; m_walletImpl = NULL; + delete m_walletListener; + m_walletListener = NULL; qDebug("m_walletImpl deleted"); } diff --git a/src/libwalletqt/Wallet.h b/src/libwalletqt/Wallet.h index c4b1dceb..f5b8a348 100644 --- a/src/libwalletqt/Wallet.h +++ b/src/libwalletqt/Wallet.h @@ -349,6 +349,7 @@ private: bool m_connectionStatusRunning; QString m_daemonUsername; QString m_daemonPassword; + Monero::WalletListener *m_walletListener; };