From fad042235bd6054d99d3f5a07529276b0138b484 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Tue, 13 Jan 2026 18:16:04 +0100 Subject: [PATCH] refactor: Remove remaining std::bind, check via clang-tidy --- src/.clang-tidy | 1 + src/qt/splashscreen.cpp | 12 +++++++++--- src/qt/transactiontablemodel.cpp | 4 +++- src/wallet/wallet.cpp | 4 +++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/.clang-tidy b/src/.clang-tidy index f54e07facae..cd42491a1ec 100644 --- a/src/.clang-tidy +++ b/src/.clang-tidy @@ -10,6 +10,7 @@ bugprone-unhandled-self-assignment, bugprone-unused-return-value, misc-unused-using-decls, misc-no-recursion, +modernize-avoid-bind, modernize-deprecated-headers, modernize-use-default-member-init, modernize-use-emplace, diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index 237df5f6e84..553f6789435 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -180,8 +180,12 @@ static void ShowProgress(SplashScreen *splash, const std::string &title, int nPr void SplashScreen::subscribeToCoreSignals() { // Connect signals to client - m_handler_init_message = m_node->handleInitMessage(std::bind(InitMessage, this, std::placeholders::_1)); - m_handler_show_progress = m_node->handleShowProgress(std::bind(ShowProgress, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); + m_handler_init_message = m_node->handleInitMessage([this](const std::string& message) { + InitMessage(this, message); + }); + m_handler_show_progress = m_node->handleShowProgress([this](const std::string& title, int nProgress, bool resume_possible) { + ShowProgress(this, title, nProgress, resume_possible); + }); m_handler_init_wallet = m_node->handleInitWallet([this]() { handleLoadWallet(); }); } @@ -190,7 +194,9 @@ void SplashScreen::handleLoadWallet() #ifdef ENABLE_WALLET if (!WalletModel::isWalletEnabled()) return; m_handler_load_wallet = m_node->walletLoader().handleLoadWallet([this](std::unique_ptr wallet) { - m_connected_wallet_handlers.emplace_back(wallet->handleShowProgress(std::bind(ShowProgress, this, std::placeholders::_1, std::placeholders::_2, false))); + m_connected_wallet_handlers.emplace_back(wallet->handleShowProgress([this](const std::string& title, int nProgress) { + ShowProgress(this, title, nProgress, /*resume_possible=*/false); + })); m_connected_wallets.emplace_back(std::move(wallet)); }); #endif diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 28734e3edd9..6c09c4d7a89 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -712,7 +712,9 @@ void TransactionTablePriv::DispatchNotifications() void TransactionTableModel::subscribeToCoreSignals() { // Connect signals to wallet - m_handler_transaction_changed = walletModel->wallet().handleTransactionChanged(std::bind(&TransactionTablePriv::NotifyTransactionChanged, priv, std::placeholders::_1, std::placeholders::_2)); + m_handler_transaction_changed = walletModel->wallet().handleTransactionChanged([this](const Txid& hash, ChangeType status) { + priv->NotifyTransactionChanged(hash, status); + }); m_handler_show_progress = walletModel->wallet().handleShowProgress([this](const std::string&, int progress) { priv->m_loading = progress < 100; priv->DispatchNotifications(); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index de260f8e49d..d12d3877e3e 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3543,7 +3543,9 @@ void CWallet::ConnectScriptPubKeyManNotifiers() { for (const auto& spk_man : GetActiveScriptPubKeyMans()) { spk_man->NotifyCanGetAddressesChanged.connect(NotifyCanGetAddressesChanged); - spk_man->NotifyFirstKeyTimeChanged.connect(std::bind(&CWallet::MaybeUpdateBirthTime, this, std::placeholders::_2)); + spk_man->NotifyFirstKeyTimeChanged.connect([this](const ScriptPubKeyMan*, int64_t time) { + MaybeUpdateBirthTime(time); + }); } }