Merge #16578: Do not pass in command line arguments to QApplication

a2714a5c69 Give QApplication dummy arguments (Andrew Chow)

Pull request description:

  QApplication takes the command line arguments and parses them itself for some [built in command line arguments](https://doc.qt.io/qt-5/qapplication.html#QApplication) that it has. We don't want any of those built in arguments, so instead give it dummy arguments.

  To test, you can use the `-reverse` option. Without this patch, everything will appear right-to-left; things that were on the left side will be on the right and everything is right aligned.

  After this patch, `-reverse` will now give a startup error since we do not support this argument.

ACKs for top commit:
  laanwj:
    ACK a2714a5c69
  hebasto:
    ACK a2714a5c69
  fanquake:
    ACK a2714a5c69 - Have tested that arguments like `-reverse` are no longer being passed through and result in an error.

Tree-SHA512: 983bd948ca6999f895b6662b58c37e33af7ed61fdd600c6b4623febb87ec06a92c66e3b3300783530110cc711902793ef82d751d7f563696c4c3a8416b2b1f51
This commit is contained in:
fanquake 2019-08-15 15:03:41 +08:00
commit 8fc7f0cba9
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1
3 changed files with 8 additions and 5 deletions

View file

@ -169,8 +169,11 @@ void BitcoinCore::shutdown()
}
}
BitcoinApplication::BitcoinApplication(interfaces::Node& node, int &argc, char **argv):
QApplication(argc, argv),
static int qt_argc = 1;
static const char* qt_argv = "bitcoin-qt";
BitcoinApplication::BitcoinApplication(interfaces::Node& node):
QApplication(qt_argc, const_cast<char **>(&qt_argv)),
coreThread(nullptr),
m_node(node),
optionsModel(nullptr),
@ -433,7 +436,7 @@ int GuiMain(int argc, char* argv[])
QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
BitcoinApplication app(*node, argc, argv);
BitcoinApplication app(*node);
// Register meta types used for QMetaObject::invokeMethod
qRegisterMetaType< bool* >();

View file

@ -56,7 +56,7 @@ class BitcoinApplication: public QApplication
{
Q_OBJECT
public:
explicit BitcoinApplication(interfaces::Node& node, int &argc, char **argv);
explicit BitcoinApplication(interfaces::Node& node);
~BitcoinApplication();
#ifdef ENABLE_WALLET

View file

@ -68,7 +68,7 @@ int main(int argc, char *argv[])
// Don't remove this, it's needed to access
// QApplication:: and QCoreApplication:: in the tests
BitcoinApplication app(*node, argc, argv);
BitcoinApplication app(*node);
app.setApplicationName("Bitcoin-Qt-test");
AppTests app_tests(app);