init: Fix crash due to -litemode and improve its deprecation warning (#3626)

* init: Fix `-litemode` crash due to not connected CClientUIInterface signal

Prior to this commit the signal
`CClientUIInterface::ThreadSafeMessageBox` is not connected to a slot in
Qt at the time its emitted when `-litemode` is used. The signal gets
emitted from `InitWarning`, in `InitParameterInteraction`. This happens
currently before `BitcoinGUI` gets created by
`app.createWindow(networkStyle.data())` in `dash.cpp` where the
signal becomes connected to the slot. After this commit the litemode
`InitWarning` will be called in `AppInitParameterInteraction` which runs
after `BitcoinGUI` has been created, means the signal will be connected
then at that point and the crash is fixed.

* init: Improve -litemode deprecation warning

- Always show a basic warning if `-litemode` gets used no matter if its
activated or not.
- Let the user know when -disablegovernance gets forced by -litemode.
This commit is contained in:
dustinface 2020-07-27 09:33:29 +02:00 committed by pasta
parent 8d99e7836c
commit bbb0064b60
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -983,11 +983,9 @@ void InitParameterInteraction()
}
if (gArgs.GetBoolArg("-litemode", false)) {
InitWarning(_("Warning: -litemode is deprecated, please use -disablegovernance.\n"));
if (gArgs.SoftSetBoolArg("-disablegovernance", true)) {
LogPrintf("%s: parameter interaction: -litemode=true -> setting -disablegovernance=true\n", __func__);
}
gArgs.ForceRemoveArg("-litemode");
}
if (gArgs.GetArg("-prune", 0) > 0) {
@ -1517,6 +1515,11 @@ bool AppInitParameterInteraction()
}
}
if (gArgs.IsArgSet("-litemode")) {
InitWarning(_("-litemode is deprecated.") + (gArgs.GetBoolArg("-litemode", false) ? (" " + _("Its replacement -disablegovernance has been forced instead.")) : ( " " + _("It has been replaced by -disablegovernance."))));
gArgs.ForceRemoveArg("-litemode");
}
fDisableGovernance = gArgs.GetBoolArg("-disablegovernance", false);
LogPrintf("fDisableGovernance %d\n", fDisableGovernance);