1
mirror of https://github.com/monero-project/monero-gui synced 2024-11-24 11:17:15 +01:00

WalletManager: fix crash on null/dangling pointer dereference

This commit is contained in:
xiphon 2019-05-28 15:46:26 +00:00
parent c286c7e5a8
commit 1cffa8b68d
2 changed files with 10 additions and 3 deletions

View File

@ -376,8 +376,14 @@ double WalletManager::miningHashRate() const
bool WalletManager::isMining() const
{
if(!m_currentWallet->connected())
return false;
{
QMutexLocker locker(&m_mutex);
if (m_currentWallet == nullptr || !m_currentWallet->connected())
{
return false;
}
}
return m_pimpl->isMining();
}
@ -412,6 +418,7 @@ QString WalletManager::resolveOpenAlias(const QString &address) const
}
bool WalletManager::parse_uri(const QString &uri, QString &address, QString &payment_id, uint64_t &amount, QString &tx_description, QString &recipient_name, QVector<QString> &unknown_parameters, QString &error) const
{
QMutexLocker locker(&m_mutex);
if (m_currentWallet)
return m_currentWallet->parse_uri(uri, address, payment_id, amount, tx_description, recipient_name, unknown_parameters, error);
return false;

View File

@ -209,7 +209,7 @@ private:
explicit WalletManager(QObject *parent = 0);
static WalletManager * m_instance;
Monero::WalletManager * m_pimpl;
QMutex m_mutex;
mutable QMutex m_mutex;
QPointer<Wallet> m_currentWallet;
QWaitCondition m_cond_pass;