409@@ -410,7 +410,7 @@ void BitcoinGUI::createActions()
410
411 connect(action, &QAction::triggered, [this, path] {
412 auto activity = new OpenWalletActivity(m_wallet_controller, this);
413- connect(activity, &OpenWalletActivity::opened, this, &BitcoinGUI::setCurrentWallet);
414+ connect(activity, &OpenWalletActivity::opened, this, &BitcoinGUI::setCurrentWallet, Qt::QueuedConnection);
There’s a good explanation here: #471#pullrequestreview-989631968 as this is the same case found in Restore Wallet.
As the default value for this parameter is Qt::AutoConnection
, it appears to be using Qt::DirectConnection
, in which the slot is invoked immediately.
https://doc.qt.io/qt-6/qt.html#ConnectionType-enum
Feels like a race that would be better being explicitly handled in the correct order?
I think Qt::DirectConnection
guarantees the correct order in this case, as BitcoinGUI::setCurrentWallet
will only run after control returns to the event loop of the receiver’s thread.