Skip to content

Commit 8fc7f0c

Browse files
committed
Merge bitcoin#16578: Do not pass in command line arguments to QApplication
a2714a5 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 a2714a5 hebasto: ACK a2714a5 fanquake: ACK a2714a5 - Have tested that arguments like `-reverse` are no longer being passed through and result in an error. Tree-SHA512: 983bd948ca6999f895b6662b58c37e33af7ed61fdd600c6b4623febb87ec06a92c66e3b3300783530110cc711902793ef82d751d7f563696c4c3a8416b2b1f51
2 parents 8516285 + a2714a5 commit 8fc7f0c

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/qt/bitcoin.cpp

+6-3
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

+1-1
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

+1-1
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)