refactor: Make scoped_connection ctor explicit

This ensures that all constructions of scoped connections are explict,
making the intent explicit and review easier. This also follows the
default recommendation from
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c46-by-default-declare-single-argument-constructors-explicit
This commit is contained in:
MarcoFalke
2026-04-09 17:14:05 +02:00
parent fa1bc1fe51
commit fa4903db8a
2 changed files with 4 additions and 4 deletions

View File

@@ -122,7 +122,7 @@ class scoped_connection
connection m_conn;
public:
scoped_connection(connection rhs) noexcept : m_conn{std::move(rhs)} {}
explicit scoped_connection(connection rhs) noexcept : m_conn{std::move(rhs)} {}
scoped_connection(scoped_connection&&) noexcept = default;

View File

@@ -485,9 +485,9 @@ int GuiMain(int argc, char* argv[])
util::ThreadSetInternalName("main");
// Subscribe to global signals from core
btcsignals::scoped_connection handler_message_box = ::uiInterface.ThreadSafeMessageBox_connect(noui_ThreadSafeMessageBox);
btcsignals::scoped_connection handler_question = ::uiInterface.ThreadSafeQuestion_connect(noui_ThreadSafeQuestion);
btcsignals::scoped_connection handler_init_message = ::uiInterface.InitMessage_connect(noui_InitMessage);
btcsignals::scoped_connection handler_message_box{::uiInterface.ThreadSafeMessageBox_connect(noui_ThreadSafeMessageBox)};
btcsignals::scoped_connection handler_question{::uiInterface.ThreadSafeQuestion_connect(noui_ThreadSafeQuestion)};
btcsignals::scoped_connection handler_init_message{::uiInterface.InitMessage_connect(noui_InitMessage)};
// Do not refer to data directory yet, this can be overridden by Intro::pickDataDirectory