Merge #14783: gui: Fix boost::signals2::no_slots_error in early calls to InitWarning

6bbdb2077e squashme: connect thru node interface (João Barbosa)
a0f8df365d qt: Call noui_connect to prevent boost::signals2::no_slots_error in early calls to InitWarning (João Barbosa)

Pull request description:

  Adding the following to `bitcoin.conf`
  ```
  [xxx]
  disablewallet=1
  ```
  And running `bitcoin-qt` gives:
  ```
  libc++abi.dylib: terminating with uncaught exception of type boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::signals2::no_slots_error> >: boost::signals2::no_slots_error
  ```

  Fixes regression in #14708.

Tree-SHA512: 7c158376fad6ebcd80fc0dbe549d5b6e893fb82e7dc1e455825633d7f91b14dc34493487cab7642152e88f9eaf99bfa91988972d600e9fb289cf26afd64aff8a
This commit is contained in:
MarcoFalke 2018-12-06 14:51:37 -05:00
commit f8456256c8
No known key found for this signature in database
GPG key ID: D2EA4850E7528B25
2 changed files with 5 additions and 12 deletions

View file

@ -71,11 +71,6 @@ Q_DECLARE_METATYPE(bool*)
Q_DECLARE_METATYPE(CAmount) Q_DECLARE_METATYPE(CAmount)
Q_DECLARE_METATYPE(uint256) Q_DECLARE_METATYPE(uint256)
static void InitMessage(const std::string& message)
{
noui_InitMessage(message);
}
/** Translate string to current locale using Qt. */ /** Translate string to current locale using Qt. */
const std::function<std::string(const char*)> G_TRANSLATION_FUN = [](const char* psz) { const std::function<std::string(const char*)> G_TRANSLATION_FUN = [](const char* psz) {
return QCoreApplication::translate("bitcoin-core", psz).toStdString(); return QCoreApplication::translate("bitcoin-core", psz).toStdString();
@ -563,6 +558,11 @@ int main(int argc, char *argv[])
std::unique_ptr<interfaces::Node> node = interfaces::MakeNode(); std::unique_ptr<interfaces::Node> node = interfaces::MakeNode();
// Subscribe to global signals from core
std::unique_ptr<interfaces::Handler> handler_message_box = node->handleMessageBox(noui_ThreadSafeMessageBox);
std::unique_ptr<interfaces::Handler> handler_question = node->handleQuestion(noui_ThreadSafeQuestion);
std::unique_ptr<interfaces::Handler> handler_init_message = node->handleInitMessage(noui_InitMessage);
// Do not refer to data directory yet, this can be overridden by Intro::pickDataDirectory // Do not refer to data directory yet, this can be overridden by Intro::pickDataDirectory
/// 1. Basic Qt initialization (not dependent on parameters or configuration) /// 1. Basic Qt initialization (not dependent on parameters or configuration)
@ -696,9 +696,6 @@ int main(int argc, char *argv[])
// Load GUI settings from QSettings // Load GUI settings from QSettings
app.createOptionsModel(gArgs.GetBoolArg("-resetguisettings", false)); app.createOptionsModel(gArgs.GetBoolArg("-resetguisettings", false));
// Subscribe to global signals from core
std::unique_ptr<interfaces::Handler> handler = node->handleInitMessage(InitMessage);
if (gArgs.GetBoolArg("-splash", DEFAULT_SPLASHSCREEN) && !gArgs.GetBoolArg("-min", false)) if (gArgs.GetBoolArg("-splash", DEFAULT_SPLASHSCREEN) && !gArgs.GetBoolArg("-min", false))
app.createSplashScreen(networkStyle.data()); app.createSplashScreen(networkStyle.data());

View file

@ -31,7 +31,6 @@
#include <chainparams.h> #include <chainparams.h>
#include <interfaces/handler.h> #include <interfaces/handler.h>
#include <interfaces/node.h> #include <interfaces/node.h>
#include <noui.h>
#include <ui_interface.h> #include <ui_interface.h>
#include <util/system.h> #include <util/system.h>
@ -1226,9 +1225,6 @@ void BitcoinGUI::showModalOverlay()
static bool ThreadSafeMessageBox(BitcoinGUI* gui, const std::string& message, const std::string& caption, unsigned int style) static bool ThreadSafeMessageBox(BitcoinGUI* gui, const std::string& message, const std::string& caption, unsigned int style)
{ {
// Redundantly log and print message in non-gui fashion
noui_ThreadSafeMessageBox(message, caption, style);
bool modal = (style & CClientUIInterface::MODAL); bool modal = (style & CClientUIInterface::MODAL);
// The SECURE flag has no effect in the Qt GUI. // The SECURE flag has no effect in the Qt GUI.
// bool secure = (style & CClientUIInterface::SECURE); // bool secure = (style & CClientUIInterface::SECURE);