From 3035478c77bba46110a73ff7f1ddb12469810f45 Mon Sep 17 00:00:00 2001 From: andreja6 Date: Mon, 11 Nov 2019 14:13:36 -0800 Subject: [PATCH] fixed memory leak --- Application.cpp | 4 +++- GUDButtonListener.cpp | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Application.cpp b/Application.cpp index a2a50c6..bab8787 100644 --- a/Application.cpp +++ b/Application.cpp @@ -603,7 +603,9 @@ void Application::onGraphics(RenderDevice* rd) { glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_COLOR_ARRAY); glEnableClientState(GL_NORMAL_ARRAY); - _dataModel->getWorkspace()->render(rd); + //if(_dataModel->getWorkspace() != NULL) + _dataModel->getWorkspace()->render(rd); + //else throw std::exception("Workspace not found"); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); diff --git a/GUDButtonListener.cpp b/GUDButtonListener.cpp index d4711d1..aae080a 100644 --- a/GUDButtonListener.cpp +++ b/GUDButtonListener.cpp @@ -62,7 +62,12 @@ void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button) if(g_selectedInstances.at(i)->canDelete) { if(GroupInstance* model = dynamic_cast(g_selectedInstances.at(i))) + { newinst = model->unGroup(); + model->setParent(NULL); + delete model; + model = NULL; + } } /*tempinst->setPosition(Vector3(tempPos.x, tempPos.y + tempSize.y, tempPos.z)); g_usableApp->cameraController.centerCamera(g_selectedInstances.at(0));*/