diff --git a/src/libwalletqt/WalletManager.cpp b/src/libwalletqt/WalletManager.cpp index 141ae97a..494c9575 100644 --- a/src/libwalletqt/WalletManager.cpp +++ b/src/libwalletqt/WalletManager.cpp @@ -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 &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; diff --git a/src/libwalletqt/WalletManager.h b/src/libwalletqt/WalletManager.h index c81fef1c..2e9f9753 100644 --- a/src/libwalletqt/WalletManager.h +++ b/src/libwalletqt/WalletManager.h @@ -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 m_currentWallet; QWaitCondition m_cond_pass;