Fix crash when closing game, while not on the main screen, with lua components active

Also delete unnecessary RemoveComponent call
This commit is contained in:
jacob1 2021-09-03 23:37:50 -04:00
parent 6cb54b1857
commit 1d0e039cec
No known key found for this signature in database
GPG Key ID: 4E58A32D510E1995
2 changed files with 1 additions and 2 deletions

View File

@ -156,12 +156,12 @@ GameController::~GameController()
{ {
delete *iter; delete *iter;
} }
delete commandInterface;
delete gameModel; delete gameModel;
if (gameView->CloseActiveWindow()) if (gameView->CloseActiveWindow())
{ {
delete gameView; delete gameView;
} }
delete commandInterface;
} }
void GameController::HistoryRestore() void GameController::HistoryRestore()

View File

@ -492,7 +492,6 @@ void LuaWindow::ClearRef(LuaComponent *luaComponent)
auto it = grabbed_components.find(luaComponent); auto it = grabbed_components.find(luaComponent);
if (it != grabbed_components.end()) if (it != grabbed_components.end())
{ {
window->RemoveComponent(luaComponent->GetComponent());
it->second.Clear(); it->second.Clear();
it->first->owner_ref = it->second; it->first->owner_ref = it->second;
grabbed_components.erase(it); grabbed_components.erase(it);