1
0
Fork 0

Don't forget to unbind() before deleting the class.

This commit is contained in:
ehofman 2004-09-23 08:57:46 +00:00
parent 5570b16192
commit 4b5d84d7fb

View file

@ -47,6 +47,7 @@ FGAIManager::FGAIManager() {
FGAIManager::~FGAIManager() {
ai_list_itr = ai_list.begin();
while(ai_list_itr != ai_list.end()) {
(*ai_list_itr)->unbind();
delete (*ai_list_itr);
++ai_list_itr;
}
@ -97,6 +98,7 @@ void FGAIManager::update(double dt) {
if ((*ai_list_itr)->getDie()) {
--numObjects[(*ai_list_itr)->getType()];
--numObjects[0];
(*ai_list_itr)->unbind();
delete (*ai_list_itr);
if ( ai_list_itr == ai_list.begin() ) {
ai_list.erase(ai_list_itr);
@ -250,6 +252,7 @@ void FGAIManager::destroyObject( void* ID ) {
if ((*ai_list_itr)->getID() == ID) {
--numObjects[0];
--numObjects[(*ai_list_itr)->getType()];
(*ai_list_itr)->unbind();
delete (*ai_list_itr);
ai_list.erase(ai_list_itr);