From f1a0314c537791f202dfb7c1209f0e04ba7988c3 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Tue, 26 May 2020 13:43:54 -0400 Subject: gui: change combiner for signals to optional_last_value optional_last_value, which does not throw, has replaced optional_value as boost's default combiner. Besides being better supported, it also doesn't trigger gcc's -Wmaybe-unitialized warning, presumably because exceptions no longer bubble-up out of signals: ```bash boost/signals2/last_value.hpp:54:36: warning: '*((void*)& value +1)' may be used uninitialized in this function [-Wmaybe-uninitialized] if(value) return value.get(); ``` The change in default happened in Boost 1.39.0 (along with the introduction of the signals 2 library. More information is available here: https://www.boost.org/doc/libs/1_73_0/doc/html/signals2/rationale.html#id-1.3.36.9.4 and here: https://www.boost.org/doc/libs/1_73_0/doc/html/boost/signals2/optional_last_value.html Co-authored-by: fanquake --- src/node/ui_interface.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/node/ui_interface.cpp b/src/node/ui_interface.cpp index 9ccd8e27e2..8d3665975d 100644 --- a/src/node/ui_interface.cpp +++ b/src/node/ui_interface.cpp @@ -6,14 +6,14 @@ #include -#include +#include #include CClientUIInterface uiInterface; struct UISignals { - boost::signals2::signal> ThreadSafeMessageBox; - boost::signals2::signal> ThreadSafeQuestion; + boost::signals2::signal> ThreadSafeMessageBox; + boost::signals2::signal> ThreadSafeQuestion; boost::signals2::signal InitMessage; boost::signals2::signal NotifyNumConnectionsChanged; boost::signals2::signal NotifyNetworkActiveChanged; @@ -42,8 +42,8 @@ ADD_SIGNALS_IMPL_WRAPPER(NotifyBlockTip); ADD_SIGNALS_IMPL_WRAPPER(NotifyHeaderTip); ADD_SIGNALS_IMPL_WRAPPER(BannedListChanged); -bool CClientUIInterface::ThreadSafeMessageBox(const bilingual_str& message, const std::string& caption, unsigned int style) { return g_ui_signals.ThreadSafeMessageBox(message, caption, style); } -bool CClientUIInterface::ThreadSafeQuestion(const bilingual_str& message, const std::string& non_interactive_message, const std::string& caption, unsigned int style) { return g_ui_signals.ThreadSafeQuestion(message, non_interactive_message, caption, style); } +bool CClientUIInterface::ThreadSafeMessageBox(const bilingual_str& message, const std::string& caption, unsigned int style) { return g_ui_signals.ThreadSafeMessageBox(message, caption, style).value_or(false);} +bool CClientUIInterface::ThreadSafeQuestion(const bilingual_str& message, const std::string& non_interactive_message, const std::string& caption, unsigned int style) { return g_ui_signals.ThreadSafeQuestion(message, non_interactive_message, caption, style).value_or(false);} void CClientUIInterface::InitMessage(const std::string& message) { return g_ui_signals.InitMessage(message); } void CClientUIInterface::NotifyNumConnectionsChanged(int newNumConnections) { return g_ui_signals.NotifyNumConnectionsChanged(newNumConnections); } void CClientUIInterface::NotifyNetworkActiveChanged(bool networkActive) { return g_ui_signals.NotifyNetworkActiveChanged(networkActive); } -- cgit v1.2.3