mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
ui: Support wallets unloaded dynamically
This commit is contained in:
@@ -364,6 +364,12 @@ bool WalletModel::changePassphrase(const SecureString &oldPass, const SecureStri
|
||||
}
|
||||
|
||||
// Handlers for core signals
|
||||
static void NotifyUnload(WalletModel* walletModel)
|
||||
{
|
||||
qDebug() << "NotifyUnload";
|
||||
QMetaObject::invokeMethod(walletModel, "unload", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
static void NotifyKeyStoreStatusChanged(WalletModel *walletmodel)
|
||||
{
|
||||
qDebug() << "NotifyKeyStoreStatusChanged";
|
||||
@@ -411,6 +417,7 @@ static void NotifyWatchonlyChanged(WalletModel *walletmodel, bool fHaveWatchonly
|
||||
void WalletModel::subscribeToCoreSignals()
|
||||
{
|
||||
// Connect signals to wallet
|
||||
m_handler_unload = m_wallet->handleUnload(boost::bind(&NotifyUnload, this));
|
||||
m_handler_status_changed = m_wallet->handleStatusChanged(boost::bind(&NotifyKeyStoreStatusChanged, this));
|
||||
m_handler_address_book_changed = m_wallet->handleAddressBookChanged(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5));
|
||||
m_handler_transaction_changed = m_wallet->handleTransactionChanged(boost::bind(NotifyTransactionChanged, this, _1, _2));
|
||||
@@ -421,6 +428,7 @@ void WalletModel::subscribeToCoreSignals()
|
||||
void WalletModel::unsubscribeFromCoreSignals()
|
||||
{
|
||||
// Disconnect signals from wallet
|
||||
m_handler_unload->disconnect();
|
||||
m_handler_status_changed->disconnect();
|
||||
m_handler_address_book_changed->disconnect();
|
||||
m_handler_transaction_changed->disconnect();
|
||||
|
||||
Reference in New Issue
Block a user