Fixed invalid memory access in Insight due to argv and argc lifetimes not being guaranteed

This commit is contained in:
Nav
2021-05-09 00:37:30 +01:00
parent 19b970d160
commit ceb72aa04d
2 changed files with 5 additions and 5 deletions

View File

@@ -48,16 +48,12 @@ void Insight::startup() {
auto targetDescriptor = this->targetControllerConsole.getTargetDescriptor();
std::string qtAppName = "Bloom";
char* appArguments[] = {qtAppName.data()};
auto appArgCount = 1;
#ifndef BLOOM_DEBUG_BUILD
QCoreApplication::addLibraryPath(QString::fromStdString(Application::getApplicationDirPath() + "/plugins"));
#endif
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
this->application = new QApplication(appArgCount, appArguments);
this->application = new QApplication(this->qtApplicationArgc, this->qtApplicationArgv.data());
this->application->setQuitOnLastWindowClosed(true);
qRegisterMetaType<Bloom::Targets::TargetPinDescriptor>();
qRegisterMetaType<Bloom::Targets::TargetPinState>();

View File

@@ -24,6 +24,10 @@ namespace Bloom
{
Q_OBJECT
private:
std::string qtApplicationName = "Bloom";
std::array<char*, 1> qtApplicationArgv = {this->qtApplicationName.data()};
int qtApplicationArgc = 1;
ApplicationConfig applicationConfig;
EnvironmentConfig environmentConfig;
InsightConfig insightConfig;