Merge pull request #2179

1cffa8b WalletManager: fix crash on null/dangling pointer dereference (xiphon)
This commit is contained in:
luigi1111 2019-06-05 22:31:39 -05:00
commit f8a6dec0ed
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
2 changed files with 10 additions and 3 deletions

View file

@ -378,8 +378,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();
}
@ -414,6 +420,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;