From 9d7a4e55f2a651ea8e420aab2cc5fa78998c1ddc Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Mon, 18 Jun 2012 15:27:57 +0100 Subject: Menu frees any added items diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp index 5c9344d..cf9324b 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 1824190..261193e 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; -- cgit v0.9.2-21-gd62e