From 9d7a4e55f2a651ea8e420aab2cc5fa78998c1ddc Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Mon, 18 Jun 2012 15:27:57 +0100 Subject: [PATCH] Menu frees any added items --- src/game/GameModel.cpp | 4 ---- src/game/Menu.h | 9 +++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp index 5c9344d8d..cf9324b37 100644 --- a/src/game/GameModel.cpp +++ b/src/game/GameModel.cpp @@ -170,10 +170,6 @@ GameModel::~GameModel() for(int i = 0; i < menuList.size(); i++) { - for(int j = 0; i < menuList[i]->GetToolList().size(); i++) - { - delete menuList[i]->GetToolList()[j]; - } delete menuList[i]; } for(int i = 0; i < brushList.size(); i++) diff --git a/src/game/Menu.h b/src/game/Menu.h index 1824190fc..261193e92 100644 --- a/src/game/Menu.h +++ b/src/game/Menu.h @@ -24,6 +24,15 @@ public: } + virtual ~Menu() + { + for(int i = 0; i < tools.size(); i++) + { + delete tools[i]; + } + tools.clear(); + } + vector GetToolList() { return tools;