mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 11:32:46 +01:00
fix(qt): allow refreshing wallet data without crashing
This commit is contained in:
parent
65800cbeb9
commit
d296005194
@ -106,10 +106,11 @@ public:
|
|||||||
|
|
||||||
/* Query entire wallet anew from core.
|
/* Query entire wallet anew from core.
|
||||||
*/
|
*/
|
||||||
void refreshWallet(interfaces::Wallet& wallet)
|
void refreshWallet(interfaces::Wallet& wallet, bool force = false)
|
||||||
{
|
{
|
||||||
parent->beginResetModel();
|
parent->beginResetModel();
|
||||||
assert(!m_loaded);
|
assert(!m_loaded || force);
|
||||||
|
cachedWallet.clear();
|
||||||
try {
|
try {
|
||||||
for (const auto& wtx : wallet.getWalletTxs()) {
|
for (const auto& wtx : wallet.getWalletTxs()) {
|
||||||
if (TransactionRecord::showTransaction()) {
|
if (TransactionRecord::showTransaction()) {
|
||||||
@ -284,9 +285,9 @@ TransactionTableModel::~TransactionTableModel()
|
|||||||
delete priv;
|
delete priv;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransactionTableModel::refreshWallet()
|
void TransactionTableModel::refreshWallet(bool force)
|
||||||
{
|
{
|
||||||
priv->refreshWallet(walletModel->wallet());
|
priv->refreshWallet(walletModel->wallet(), force);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */
|
/** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */
|
||||||
@ -846,12 +847,13 @@ void TransactionTablePriv::DispatchNotifications()
|
|||||||
|
|
||||||
vQueueNotifications[i].invoke(parent);
|
vQueueNotifications[i].invoke(parent);
|
||||||
}
|
}
|
||||||
|
vQueueNotifications.clear();
|
||||||
} else {
|
} else {
|
||||||
// it's much faster to just refresh the whole thing instead
|
// it's much faster to just drop all the queued notifications and refresh the whole thing instead
|
||||||
bool invoked = QMetaObject::invokeMethod(parent, "refreshWallet", Qt::QueuedConnection);
|
vQueueNotifications.clear();
|
||||||
|
bool invoked = QMetaObject::invokeMethod(parent, "refreshWallet", Qt::QueuedConnection, Q_ARG(bool, true));
|
||||||
assert(invoked);
|
assert(invoked);
|
||||||
}
|
}
|
||||||
vQueueNotifications.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransactionTableModel::subscribeToCoreSignals()
|
void TransactionTableModel::subscribeToCoreSignals()
|
||||||
|
@ -114,7 +114,7 @@ private:
|
|||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/* Refresh the whole wallet, helpful for huge notification queues */
|
/* Refresh the whole wallet, helpful for huge notification queues */
|
||||||
void refreshWallet();
|
void refreshWallet(bool foce = false);
|
||||||
/* New transaction, or transaction changed status */
|
/* New transaction, or transaction changed status */
|
||||||
void updateTransaction(const QString &hash, int status, bool showTransaction);
|
void updateTransaction(const QString &hash, int status, bool showTransaction);
|
||||||
void updateAddressBook(const QString &address, const QString &label,
|
void updateAddressBook(const QString &address, const QString &label,
|
||||||
|
Loading…
Reference in New Issue
Block a user