Feature/globals handling (#1352)

* Cleaner handling of global state
* Prevent Lua memory corruption (closes #982)
* Initialize glfw first thing to prevent weird joystick loading bug during startup
This commit is contained in:
Alexander Bock
2020-10-21 22:30:05 +02:00
committed by GitHub
parent 1525a0490d
commit efffc25ce0
164 changed files with 1484 additions and 1390 deletions
+4 -4
View File
@@ -53,9 +53,9 @@ int main(int argc, char** argv) {
);
std::string configFile = configuration::findConfiguration();
global::configuration = configuration::loadConfigurationFromFile(configFile);
global::openSpaceEngine.registerPathTokens();
global::openSpaceEngine.initialize();
*global::configuration = configuration::loadConfigurationFromFile(configFile);
global::openSpaceEngine->registerPathTokens();
global::openSpaceEngine->initialize();
FileSys.registerPathToken("${TESTDIR}", "${BASE}/tests");
@@ -66,6 +66,6 @@ int main(int argc, char** argv) {
// And the deinitialization needs the SpiceManager to be initialized
openspace::SpiceManager::initialize();
global::openSpaceEngine.deinitialize();
global::openSpaceEngine->deinitialize();
return result;
}
+4 -4
View File
@@ -52,7 +52,7 @@ namespace {
TEST_CASE("AssetLoader: Assertion", "[assetloader]") {
openspace::Scene scene(std::make_unique<openspace::SingleThreadedSceneInitializer>());
ghoul::lua::LuaState* state = openspace::global::scriptEngine.luaState();
ghoul::lua::LuaState* state = openspace::global::scriptEngine->luaState();
openspace::SynchronizationWatcher syncWatcher;
openspace::AssetLoader assetLoader(
state,
@@ -66,7 +66,7 @@ TEST_CASE("AssetLoader: Assertion", "[assetloader]") {
TEST_CASE("AssetLoader: Basic Export Import", "[assetloader]") {
openspace::Scene scene(std::make_unique<openspace::SingleThreadedSceneInitializer>());
ghoul::lua::LuaState* state = openspace::global::scriptEngine.luaState();
ghoul::lua::LuaState* state = openspace::global::scriptEngine->luaState();
openspace::SynchronizationWatcher syncWatcher;
openspace::AssetLoader assetLoader(
state,
@@ -79,7 +79,7 @@ TEST_CASE("AssetLoader: Basic Export Import", "[assetloader]") {
TEST_CASE("AssetLoader: Asset Functions", "[assetloader]") {
openspace::Scene scene(std::make_unique<openspace::SingleThreadedSceneInitializer>());
ghoul::lua::LuaState* state = openspace::global::scriptEngine.luaState();
ghoul::lua::LuaState* state = openspace::global::scriptEngine->luaState();
openspace::SynchronizationWatcher syncWatcher;
openspace::AssetLoader assetLoader(
state,
@@ -92,7 +92,7 @@ TEST_CASE("AssetLoader: Asset Functions", "[assetloader]") {
TEST_CASE("AssetLoader: Asset Initialization", "[assetloader]") {
openspace::Scene scene(std::make_unique<openspace::SingleThreadedSceneInitializer>());
ghoul::lua::LuaState* state = openspace::global::scriptEngine.luaState();
ghoul::lua::LuaState* state = openspace::global::scriptEngine->luaState();
openspace::SynchronizationWatcher syncWatcher;
openspace::AssetLoader assetLoader(
state,