From 079fd33cf18cc901d1a6a4463d8a8ccd1d730786 Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Sat, 7 Nov 2020 17:32:30 -0500
Subject: added sanitychecks.h, moved to namespace sanity added a set
SetThisThreadName() after creating the main window, Qt resets it
---
src/main.cpp | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
(limited to 'src/main.cpp')
diff --git a/src/main.cpp b/src/main.cpp
index 55fedc7a..40512006 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -32,6 +32,7 @@ along with Mod Organizer. If not, see .
#include "env.h"
#include "envmodule.h"
#include "commandline.h"
+#include "sanitychecks.h"
#include "shared/util.h"
#include "shared/appconfig.h"
#include "shared/error_report.h"
@@ -41,14 +42,9 @@ along with Mod Organizer. If not, see .
#include
#include
-
using namespace MOBase;
using namespace MOShared;
-void sanityChecks(const env::Environment& env);
-int checkIncompatibleModule(const env::Module& m);
-int checkPathsForSanity(MOBase::IPluginGame& game, const Settings& s);
-
void purgeOldFiles()
{
// remove the temporary backup directory in case we're restarting after an
@@ -159,11 +155,11 @@ int runApplication(
env::Environment env;
env.dump(settings);
settings.dump();
- sanityChecks(env);
+ sanity::checkEnvironment(env);
const auto moduleNotification = env.onModuleLoaded(qApp, [](auto&& m) {
log::debug("loaded module {}", m.toString());
- checkIncompatibleModule(m);
+ sanity::checkIncompatibleModule(m);
});
// this must outlive `organizer`
@@ -204,7 +200,7 @@ int runApplication(
log::debug("this is a portable instance");
}
- checkPathsForSanity(*currentInstance.gamePlugin(), settings);
+ sanity::checkPaths(*currentInstance.gamePlugin(), settings);
organizer.setManagedGame(currentInstance.gamePlugin());
organizer.createDefaultProfile();
@@ -249,10 +245,14 @@ int runApplication(
int res = 1;
- { // scope to control lifetime of mainwindow
+ {
+ // scope to control lifetime of mainwindow
// set up main window and its data structures
MainWindow mainWindow(settings, organizer, *pluginContainer);
+ // qt resets the thread name somewhere when creating the main window
+ MOShared::SetThisThreadName("main");
+
ni.getAccessManager()->setTopLevelWidget(&mainWindow);
QObject::connect(&mainWindow, SIGNAL(styleChanged(QString)), &application,
@@ -373,6 +373,8 @@ int doOneRun(
int main(int argc, char *argv[])
{
+ MOShared::SetThisThreadName("main");
+
cl::CommandLine cl;
if (auto r=cl.run(GetCommandLineW())) {
@@ -381,8 +383,6 @@ int main(int argc, char *argv[])
TimeThis tt("main() to doOneRun()");
- SetThisThreadName("main");
-
initLogging();
auto application = MOApplication::create(argc, argv);
--
cgit v1.3.1