Initialize QCoreApplication before calling showHelp

This commit is contained in:
Dale Glass 2022-06-27 20:30:00 +02:00
parent 4204056f2e
commit 545ee0840b
3 changed files with 3 additions and 0 deletions

View file

@ -130,6 +130,7 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
auto &logHandler = LogHandler::getInstance();
if (parser.isSet(logOption)) {
if (!logHandler.parseOptions(parser.value(logOption).toUtf8())) {
QCoreApplication mockApp(argc, const_cast<char**>(argv)); // required for call to showHelp()
parser.showHelp();
Q_UNREACHABLE();
}

View file

@ -443,6 +443,7 @@ void DomainServer::parseCommandLine(int argc, char* argv[]) {
auto &logHandler = LogHandler::getInstance();
if (parser.isSet(logOption)) {
if (!logHandler.parseOptions(parser.value(logOption).toUtf8())) {
QCoreApplication mockApp(argc, const_cast<char**>(argv)); // required for call to showHelp()
parser.showHelp();
Q_UNREACHABLE();
}

View file

@ -312,6 +312,7 @@ int main(int argc, const char* argv[]) {
auto &logHandler = LogHandler::getInstance();
if (parser.isSet(logOption)) {
if (!logHandler.parseOptions(parser.value(logOption).toUtf8())) {
QCoreApplication mockApp(argc, const_cast<char**>(argv)); // required for call to showHelp()
parser.showHelp();
Q_UNREACHABLE();
}