Changeset View
Changeset View
Standalone View
Standalone View
src/qt/walletcontroller.cpp
Show First 20 Lines • Show All 127 Lines • ▼ Show 20 Lines | WalletModel *WalletController::getOrCreateWallet( | ||||
// Notify walletAdded signal on the GUI thread. | // Notify walletAdded signal on the GUI thread. | ||||
if (QThread::currentThread() == thread()) { | if (QThread::currentThread() == thread()) { | ||||
addWallet(wallet_model); | addWallet(wallet_model); | ||||
} else { | } else { | ||||
// Handler callback runs in a different thread so fix wallet model | // Handler callback runs in a different thread so fix wallet model | ||||
// thread affinity. | // thread affinity. | ||||
wallet_model->moveToThread(thread()); | wallet_model->moveToThread(thread()); | ||||
bool invoked = | |||||
QMetaObject::invokeMethod(this, "addWallet", Qt::QueuedConnection, | QMetaObject::invokeMethod(this, "addWallet", Qt::QueuedConnection, | ||||
Q_ARG(WalletModel *, wallet_model)); | Q_ARG(WalletModel *, wallet_model)); | ||||
assert(invoked); | |||||
} | } | ||||
return wallet_model; | return wallet_model; | ||||
} | } | ||||
void WalletController::addWallet(WalletModel *wallet_model) { | void WalletController::addWallet(WalletModel *wallet_model) { | ||||
// Take ownership of the wallet model and register it. | // Take ownership of the wallet model and register it. | ||||
wallet_model->setParent(this); | wallet_model->setParent(this); | ||||
Show All 38 Lines |