Fix crash that occurs if there is an error in the SGCT configuration file

This commit is contained in:
Alexander Bock
2017-02-22 15:31:59 -05:00
parent 2ee1f9984c
commit 965cf6bd9a
6 changed files with 17 additions and 10 deletions
+2
View File
@@ -198,6 +198,8 @@ int main_main(int argc, char** argv) {
_sgctEngine->render();
LDEBUG("Ending rendering loop");
OsEng.deinitialize();
//clear function bindings to avoid crash after destroying the OpenSpace Engine
sgct::MessageHandler::instance()->setLogToCallback(false);
sgct::MessageHandler::instance()->setLogCallback(nullptr);
@@ -98,6 +98,7 @@ public:
// SGCT callbacks
bool initialize();
bool initializeGL();
void deinitialize();
void preSynchronization();
void postSynchronizationPreDraw();
void render(const glm::mat4& projectionMatrix, const glm::mat4& viewMatrix);
+9 -3
View File
@@ -408,9 +408,15 @@ void GUI::deinitializeGL() {
_program = nullptr;
_fontTexture = nullptr;
glDeleteVertexArrays(1, &vao);
glDeleteBuffers(1, &vbo);
glDeleteBuffers(1, &vboElements);
if (vao) {
glDeleteVertexArrays(1, &vao);
}
if (vbo) {
glDeleteBuffers(1, &vbo);
}
if (vboElements) {
glDeleteBuffers(1, &vboElements);
}
_iswa.deinitializeGL();
_help.deinitializeGL();
+4 -5
View File
@@ -175,11 +175,6 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName,
}
OpenSpaceEngine::~OpenSpaceEngine() {
LINFO("_windowWrapper->isUsingSwapGroups(): " << _windowWrapper->isUsingSwapGroups());
LINFO("_windowWrapper->isSwapGroupMaster(): " << _windowWrapper->isSwapGroupMaster());
_interactionHandler->deinitialize();
_renderEngine->deinitialize();
_globalPropertyNamespace = nullptr;
_windowWrapper = nullptr;
_parallelConnection = nullptr;
@@ -529,6 +524,10 @@ bool OpenSpaceEngine::initialize() {
return true;
}
void OpenSpaceEngine::deinitialize() {
_interactionHandler->deinitialize();
_renderEngine->deinitialize();
}
void OpenSpaceEngine::writeDocumentation() {
// If a LuaDocumentationFile was specified, generate it now
-1
View File
@@ -170,7 +170,6 @@ bool SGCTWindowWrapper::isSwapGroupMaster() const {
bool SGCTWindowWrapper::isUsingSwapGroups() const {
return sgct::Engine::instance()->getCurrentWindowPtr()->isUsingSwapGroups();
}
glm::mat4 SGCTWindowWrapper::viewProjectionMatrix() const {
return sgct::Engine::instance()->getCurrentModelViewProjectionMatrix();
+1 -1
View File
@@ -114,6 +114,7 @@ const std::vector<RenderEngine::FrametimeType> RenderEngine::FrametimeTypes({
RenderEngine::RenderEngine()
: _mainCamera(nullptr)
, _raycasterManager(nullptr)
, _performanceMeasurements("performanceMeasurements", "Performance Measurements")
, _frametimeType(
"frametimeType",
@@ -172,7 +173,6 @@ RenderEngine::~RenderEngine() {
delete _mainCamera;
delete _raycasterManager;
}
bool RenderEngine::deinitialize() {