From 4c92b9ccbbfb42a6c9c8d16271c153d809898747 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 23 Dec 2017 20:39:23 +0100 Subject: [PATCH] First steps towards making OpenSpaceEngine resilient against SGCT configuration errors --- apps/OpenSpace/main.cpp | 15 +++++++++------ ext/sgct | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index efcf2675dc..f605554782 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -28,7 +28,7 @@ #include #include -//#include +#include #include @@ -584,8 +584,11 @@ int main_main(int argc, char** argv) { "Unknown OpenGL version. Missing statement in version mapping map" ); - auto cleanup = [&](){ - OsEng.deinitialize(); + using IsInitialized = ghoul::Boolean; + auto cleanup = [&](IsInitialized isInitialized){ + if (isInitialized) { + OsEng.deinitialize(); + } // Clear function bindings to avoid crash after destroying the OpenSpace Engine sgct::MessageHandler::instance()->setLogToCallback(false); @@ -621,7 +624,7 @@ int main_main(int argc, char** argv) { if (!initSuccess) { LFATAL("Initializing failed"); - cleanup(); + cleanup(IsInitialized::No); return EXIT_FAILURE; } @@ -629,8 +632,8 @@ int main_main(int argc, char** argv) { LDEBUG("Starting rendering loop"); SgctEngine->render(); LDEBUG("Ending rendering loop"); - - cleanup(); + + cleanup(IsInitialized::Yes); // Exit program exit(EXIT_SUCCESS); diff --git a/ext/sgct b/ext/sgct index 81d1fe53b2..e1228d8be5 160000 --- a/ext/sgct +++ b/ext/sgct @@ -1 +1 @@ -Subproject commit 81d1fe53b26f28c244ea96536918828530069922 +Subproject commit e1228d8be50065bba0ad86905f3727ab7eb26ff2