mirror of
https://github.com/feather-wallet/feather.git
synced 2024-12-22 11:39:25 +00:00
fix a few memory leaks
This commit is contained in:
parent
37aa04e3e5
commit
c31b351b17
9 changed files with 31 additions and 19 deletions
|
@ -323,7 +323,7 @@ void MainWindow::initMenu() {
|
|||
|
||||
// Show/Hide Coins
|
||||
connect(ui->actionShow_Coins, &QAction::triggered, m_tabShowHideSignalMapper, QOverload<>::of(&QSignalMapper::map));
|
||||
m_tabShowHideMapper["Coins"] = new ToggleTab(ui->tabCoins, "Coins", "Coins", ui->actionShow_Coins);
|
||||
m_tabShowHideMapper["Coins"] = new ToggleTab(ui->tabCoins, "Coins", "Coins", ui->actionShow_Coins, this);
|
||||
m_tabShowHideSignalMapper->setMapping(ui->actionShow_Coins, "Coins");
|
||||
|
||||
// Show/Hide Plugins..
|
||||
|
@ -335,7 +335,7 @@ void MainWindow::initMenu() {
|
|||
auto* pluginAction = new QAction(QString("Show %1").arg(plugin->displayName()), this);
|
||||
ui->menuView->insertAction(plugin->insertFirst() ? ui->actionPlaceholderBegin : ui->actionPlaceholderEnd, pluginAction);
|
||||
connect(pluginAction, &QAction::triggered, m_tabShowHideSignalMapper, QOverload<>::of(&QSignalMapper::map));
|
||||
m_tabShowHideMapper[plugin->displayName()] = new ToggleTab(plugin->tab(), plugin->displayName(), plugin->displayName(), pluginAction);
|
||||
m_tabShowHideMapper[plugin->displayName()] = new ToggleTab(plugin->tab(), plugin->displayName(), plugin->displayName(), pluginAction, this);
|
||||
m_tabShowHideSignalMapper->setMapping(pluginAction, plugin->displayName());
|
||||
}
|
||||
ui->actionPlaceholderBegin->setVisible(false);
|
||||
|
|
|
@ -51,9 +51,12 @@ namespace Ui {
|
|||
class MainWindow;
|
||||
}
|
||||
|
||||
struct ToggleTab {
|
||||
ToggleTab(QWidget *tab, QString name, QString description, QAction *menuAction) :
|
||||
tab(tab), key(std::move(name)), name(std::move(description)), menuAction(menuAction) {}
|
||||
class ToggleTab : QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ToggleTab(QWidget *tab, QString name, QString description, QAction *menuAction, QObject *parent = nullptr) :
|
||||
QObject(parent), tab(tab), key(std::move(name)), name(std::move(description)), menuAction(menuAction) {}
|
||||
QWidget *tab;
|
||||
QString key;
|
||||
QString name;
|
||||
|
|
|
@ -71,7 +71,7 @@ ReceiveWidget::ReceiveWidget(Wallet *wallet, QWidget *parent)
|
|||
|
||||
// context menu
|
||||
ui->addresses->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
m_showTransactionsAction = new QAction("Show transactions");
|
||||
m_showTransactionsAction = new QAction("Show transactions", this);
|
||||
connect(m_showTransactionsAction, &QAction::triggered, this, &ReceiveWidget::onShowTransactions);
|
||||
connect(ui->addresses, &QTreeView::customContextMenuRequested, this, &ReceiveWidget::showContextMenu);
|
||||
connect(ui->addresses, &SubaddressView::copyAddress, this, &ReceiveWidget::copyAddress);
|
||||
|
|
|
@ -105,7 +105,7 @@ void TransactionHistory::refresh()
|
|||
if (payment_id.substr(16).find_first_not_of('0') == std::string::npos)
|
||||
payment_id = payment_id.substr(0,16);
|
||||
|
||||
auto* t = new TransactionRow();
|
||||
auto* t = new TransactionRow(this);
|
||||
t->m_paymentId = QString::fromStdString(payment_id);
|
||||
t->m_coinbase = pd.m_coinbase;
|
||||
t->m_amount = pd.m_amount;
|
||||
|
@ -152,7 +152,7 @@ void TransactionHistory::refresh()
|
|||
if (payment_id.substr(16).find_first_not_of('0') == std::string::npos)
|
||||
payment_id = payment_id.substr(0,16);
|
||||
|
||||
auto* t = new TransactionRow();
|
||||
auto* t = new TransactionRow(this);
|
||||
t->m_paymentId = QString::fromStdString(payment_id);
|
||||
|
||||
t->m_amount = pd.m_amount_out - change;
|
||||
|
@ -206,7 +206,7 @@ void TransactionHistory::refresh()
|
|||
payment_id = payment_id.substr(0,16);
|
||||
bool is_failed = pd.m_state == tools::wallet2::unconfirmed_transfer_details::failed;
|
||||
|
||||
auto *t = new TransactionRow();
|
||||
auto *t = new TransactionRow(this);
|
||||
t->m_paymentId = QString::fromStdString(payment_id);
|
||||
|
||||
t->m_amount = pd.m_amount_out - change;
|
||||
|
@ -254,7 +254,7 @@ void TransactionHistory::refresh()
|
|||
std::string payment_id = epee::string_tools::pod_to_hex(i->first);
|
||||
if (payment_id.substr(16).find_first_not_of('0') == std::string::npos)
|
||||
payment_id = payment_id.substr(0,16);
|
||||
auto *t = new TransactionRow();
|
||||
auto *t = new TransactionRow(this);
|
||||
t->m_paymentId = QString::fromStdString(payment_id);
|
||||
t->m_amount = pd.m_amount;
|
||||
t->m_balanceDelta = pd.m_amount;
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
#include "Transfer.h"
|
||||
#include "Ring.h"
|
||||
|
||||
TransactionRow::TransactionRow()
|
||||
: m_direction(TransactionRow::Direction_Out)
|
||||
TransactionRow::TransactionRow(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_direction(TransactionRow::Direction_Out)
|
||||
, m_pending(false)
|
||||
, m_failed(false)
|
||||
, m_coinbase(false)
|
||||
|
@ -165,3 +166,9 @@ QString TransactionRow::rings_formatted() const
|
|||
}
|
||||
return rings;
|
||||
}
|
||||
|
||||
TransactionRow::~TransactionRow()
|
||||
{
|
||||
qDeleteAll(m_transfers);
|
||||
qDeleteAll(m_rings);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@ class TransactionRow : public QObject
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
~TransactionRow() override;
|
||||
|
||||
enum Direction {
|
||||
Direction_In = 0,
|
||||
Direction_Out = 1,
|
||||
|
@ -52,12 +54,12 @@ public:
|
|||
QString rings_formatted() const;
|
||||
|
||||
private:
|
||||
explicit TransactionRow();
|
||||
explicit TransactionRow(QObject *parent);
|
||||
|
||||
private:
|
||||
friend class TransactionHistory;
|
||||
mutable QList<Transfer*> m_transfers;
|
||||
mutable QList<Ring*> m_rings;
|
||||
QList<Transfer*> m_transfers;
|
||||
QList<Ring*> m_rings;
|
||||
qint64 m_amount; // Amount that was sent (to destinations) or received, excludes tx fee
|
||||
qint64 m_balanceDelta; // How much the total balance was mutated as a result of this tx (includes tx fee)
|
||||
quint64 m_blockHeight;
|
||||
|
|
|
@ -20,7 +20,7 @@ XMRigWidget::XMRigWidget(Wallet *wallet, QWidget *parent)
|
|||
: QWidget(parent)
|
||||
, ui(new Ui::XMRigWidget)
|
||||
, m_wallet(wallet)
|
||||
, m_XMRig(new XmRig(Config::defaultConfigDir().path()))
|
||||
, m_XMRig(new XmRig(Config::defaultConfigDir().path(), this))
|
||||
, m_model(new QStandardItemModel(this))
|
||||
, m_contextMenu(new QMenu(this))
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ NetworkProxyWidget::NetworkProxyWidget(QWidget *parent)
|
|||
connect(ui->line_host, &QLineEdit::textChanged, this, &NetworkProxyWidget::onProxySettingsChanged);
|
||||
|
||||
// [Port]
|
||||
auto *portValidator = new QRegularExpressionValidator{QRegularExpression("[0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]")};
|
||||
auto *portValidator = new QRegularExpressionValidator{QRegularExpression("[0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]"), this};
|
||||
ui->line_port->setValidator(portValidator);
|
||||
ui->line_port->setText(conf()->get(Config::socks5Port).toString());
|
||||
connect(ui->line_port, &QLineEdit::textChanged, this, &NetworkProxyWidget::onProxySettingsChanged);
|
||||
|
|
|
@ -16,7 +16,7 @@ PageSetSubaddressLookahead::PageSetSubaddressLookahead(WizardFields *fields, QWi
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
auto *indexValidator = new QRegularExpressionValidator{QRegularExpression("[0-9]{0,5}")};
|
||||
auto *indexValidator = new QRegularExpressionValidator{QRegularExpression("[0-9]{0,5}"), this};
|
||||
|
||||
ui->line_major->setValidator(indexValidator);
|
||||
connect(ui->line_major, &QLineEdit::textChanged, [this]{
|
||||
|
|
Loading…
Reference in a new issue