Skip to content

Commit a2714a5

Browse files
committed
Give QApplication dummy arguments
QApplication takes the command line arguments and parses them itself for some built in command line arguments that it has. We don't want any of those built in arguments, so instead give it dummy arguments.
1 parent e47e36c commit a2714a5

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/qt/bitcoin.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,11 @@ void BitcoinCore::shutdown()
169169
}
170170
}
171171

172-
BitcoinApplication::BitcoinApplication(interfaces::Node& node, int &argc, char **argv):
173-
QApplication(argc, argv),
172+
static int qt_argc = 1;
173+
static const char* qt_argv = "bitcoin-qt";
174+
175+
BitcoinApplication::BitcoinApplication(interfaces::Node& node):
176+
QApplication(qt_argc, const_cast<char **>(&qt_argv)),
174177
coreThread(nullptr),
175178
m_node(node),
176179
optionsModel(nullptr),
@@ -433,7 +436,7 @@ int GuiMain(int argc, char* argv[])
433436
QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
434437
#endif
435438

436-
BitcoinApplication app(*node, argc, argv);
439+
BitcoinApplication app(*node);
437440

438441
// Register meta types used for QMetaObject::invokeMethod
439442
qRegisterMetaType< bool* >();

src/qt/bitcoin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class BitcoinApplication: public QApplication
5656
{
5757
Q_OBJECT
5858
public:
59-
explicit BitcoinApplication(interfaces::Node& node, int &argc, char **argv);
59+
explicit BitcoinApplication(interfaces::Node& node);
6060
~BitcoinApplication();
6161

6262
#ifdef ENABLE_WALLET

src/qt/test/test_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ int main(int argc, char *argv[])
6868

6969
// Don't remove this, it's needed to access
7070
// QApplication:: and QCoreApplication:: in the tests
71-
BitcoinApplication app(*node, argc, argv);
71+
BitcoinApplication app(*node);
7272
app.setApplicationName("Bitcoin-Qt-test");
7373

7474
AppTests app_tests(app);

0 commit comments

Comments
 (0)