Skip to content

Commit 1acf1db

Browse files
committed
Do not ask a UI question from bitcoind
1 parent 0833894 commit 1acf1db

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

src/init.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1317,8 +1317,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
13171317
if (!fLoaded) {
13181318
// first suggest a reindex
13191319
if (!fReset) {
1320-
bool fRet = uiInterface.ThreadSafeMessageBox(
1320+
bool fRet = uiInterface.ThreadSafeQuestion(
13211321
strLoadError + ".\n\n" + _("Do you want to rebuild the block database now?"),
1322+
strLoadError + ".\nPlease restart with -reindex or -reindex-chainstate to recover.",
13221323
"", CClientUIInterface::MSG_ERROR | CClientUIInterface::BTN_ABORT);
13231324
if (fRet) {
13241325
fReindex = true;

src/noui.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ static bool noui_ThreadSafeMessageBox(const std::string& message, const std::str
3939
return false;
4040
}
4141

42+
static bool noui_ThreadSafeQuestion(const std::string& /* ignored interactive message */, const std::string& message, const std::string& caption, unsigned int style)
43+
{
44+
return noui_ThreadSafeMessageBox(message, caption, style);
45+
}
46+
4247
static void noui_InitMessage(const std::string& message)
4348
{
4449
LogPrintf("init message: %s\n", message);
@@ -48,5 +53,6 @@ void noui_connect()
4853
{
4954
// Connect bitcoind signal handlers
5055
uiInterface.ThreadSafeMessageBox.connect(noui_ThreadSafeMessageBox);
56+
uiInterface.ThreadSafeQuestion.connect(noui_ThreadSafeQuestion);
5157
uiInterface.InitMessage.connect(noui_InitMessage);
5258
}

src/qt/bitcoingui.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,12 +1105,14 @@ void BitcoinGUI::subscribeToCoreSignals()
11051105
{
11061106
// Connect signals to client
11071107
uiInterface.ThreadSafeMessageBox.connect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3));
1108+
uiInterface.ThreadSafeQuestion.connect(boost::bind(ThreadSafeMessageBox, this, _1, _3, _4));
11081109
}
11091110

11101111
void BitcoinGUI::unsubscribeFromCoreSignals()
11111112
{
11121113
// Disconnect signals from client
11131114
uiInterface.ThreadSafeMessageBox.disconnect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3));
1115+
uiInterface.ThreadSafeQuestion.disconnect(boost::bind(ThreadSafeMessageBox, this, _1, _3, _4));
11141116
}
11151117

11161118
UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle *platformStyle) :

src/ui_interface.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ class CClientUIInterface
7676
/** Show message box. */
7777
boost::signals2::signal<bool (const std::string& message, const std::string& caption, unsigned int style), boost::signals2::last_value<bool> > ThreadSafeMessageBox;
7878

79+
/** If possible, ask the user a question. If not, falls back to ThreadSafeMessageBox(noninteractive_message, caption, style) and returns false. */
80+
boost::signals2::signal<bool (const std::string& message, const std::string& noninteractive_message, const std::string& caption, unsigned int style), boost::signals2::last_value<bool> > ThreadSafeQuestion;
81+
7982
/** Progress message during initialization. */
8083
boost::signals2::signal<void (const std::string &message)> InitMessage;
8184

0 commit comments

Comments
 (0)