From: ehofman Date: Fri, 28 Nov 2003 20:16:59 +0000 (+0000) Subject: Don't destroy the elements ourselves. Instead clear X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a9c6ca26afe992e09d853686e428928158a2c9d5;p=flightgear.git Don't destroy the elements ourselves. Instead clear () calls the destructor for each element itself. --- diff --git a/src/AIModel/AIManager.cxx b/src/AIModel/AIManager.cxx index 08c215aa7..9e9b310f2 100644 --- a/src/AIModel/AIManager.cxx +++ b/src/AIModel/AIManager.cxx @@ -37,11 +37,6 @@ FGAIManager::FGAIManager() { } FGAIManager::~FGAIManager() { - ai_list_itr = ai_list.begin(); - while(ai_list_itr != ai_list.end()) { - delete (*ai_list_itr); - ++ai_list_itr; - } ai_list.clear(); } @@ -123,8 +118,6 @@ void FGAIManager::update(double dt) { ai_list_itr = ai_list.begin(); while(ai_list_itr != ai_list.end()) { if ((*ai_list_itr)->getDie()) { - // FIXME: delete object itself before removing it from the list. - // delete (*ai_list_itr); ai_list.erase(ai_list_itr, ai_list_itr); } else { (*ai_list_itr)->update(dt);