216 | + QTimer::singleShot(500, worker(), [this, path] {
217 | + std::unique_ptr<interfaces::Wallet> wallet = node().loadWallet(path, m_error_message, m_warning_message);
218 | +
219 | + if (wallet) m_wallet_model = m_wallet_controller->getOrCreateWallet(std::move(wallet));
220 | +
221 | + QTimer::singleShot(500, this, &OpenWalletActivity::finish);
OpenWalletActivity::finish() could be inlined here.
OpenWalletActivity::open() will remain small enough and readability will be improved, no?
OpenWalletActivity::finish() could be inlined here.
At the time I had 2 reasons to not do that:
finish could be called from multiple places, also initially it was a virtual method in the super class;
- wanted to avoid nesting lambdas.
Could it be just
finish();
?
No, this finish() is not thread safe - it would be called from the worker thread.
... this finish() is not thread safe - it would be called from the worker thread.
Right. But thread safety is not required for finish(), IMO.
But it is, see OpenWalletActivity::finish(), it must be called on the GUI thread.