Skip to content

Commit

Permalink
Qt: fix #2813
Browse files Browse the repository at this point in the history
Ensures the lifetime of argc/argv is greater than the QApplication,
and that argv is non-empty. This conforms with Qt docs.
  • Loading branch information
scurest authored and gonetz committed Mar 10, 2024
1 parent e568bab commit 3abe0c5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/GLideNUI/GLideNUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ int openConfigDialog(const wchar_t * _strFileName, const wchar_t * _strSharedFil
if (config.generalEmulation.enableCustomSettings != 0 && _romName != nullptr && strlen(_romName) != 0)
loadCustomRomSettings(strIniFileName, strSharedIniFileName, _romName);

int argc = 1;
char argv0[] = "GLideN64";
char * argv[] = { argv0 };
std::unique_ptr<QApplication> pQApp;
QCoreApplication* pApp = QCoreApplication::instance();

if (pApp == nullptr) {
int argc = 0;
char * argv = 0;
pQApp.reset(new QApplication(argc, &argv));
pQApp.reset(new QApplication(argc, argv));
pApp = pQApp.get();
}

Expand All @@ -63,9 +64,10 @@ int openAboutDialog(const wchar_t * _strFileName)
cleanMyResource();
initMyResource();

int argc = 0;
char * argv = 0;
QApplication a(argc, &argv);
int argc = 1;
char argv0[] = "GLideN64";
char * argv[] = { argv0 };
QApplication a(argc, argv);

QTranslator translator;
if (translator.load(getTranslationFile(), QString::fromWCharArray(_strFileName)))
Expand Down

0 comments on commit 3abe0c5

Please sign in to comment.