   Access violation reading location 0xfeeefef2
  Hello,I am currently working on top-down scrolling shooter, but am having a problem with getting the particle engine to be able to 'bind' and emitter to an Enemy (Works fine on players, and they both derive from the same Actor class).The code compiles fine and runs perfectly normal (With the enemies having flame trails etc) but only for about 2-5 seconds, then I receive the following error:Unhandled exception at 0x0047cbdb in Carry-On Assault.exe: 0xC0000005: Access violation reading location 0xfeeefef2.The error points to the line://Set the age of the Emitter(*updater).nLifeInfo.iAge = (*updater).boundObject->getCurHealth(); The update function for the particle engine is as followsvoid Particle_Engine::updateEmitters(){for(std::list<Particle_Emitter>::iterator updater = EmitterList.begin(); updater != EmitterList.end();){//If its bound to an Objectif((*updater).getBound() == true) {//If it's time hasnt expired if( (*updater).nLifeInfo.iAge >= 0   ){//decrease it's age--(*updater).nLifeInfo.iAge; (*updater).Position.X = (*updater).boundObject->Position.X;(*updater).Position.Y = (*updater).boundObject->Position.Y;(*updater).setDirection( (*updater).boundObject->iDirection );//Set the age of the Emitter(*updater).nLifeInfo.iAge = (*updater).boundObject->getCurHealth(); (*updater).updateParticles(); //Update the particle's themselfupdater++; //Next Emitter}else{//If it HAS run out of life or the bound object has NO health//(*updater).setBound(false); //I tried these 2 lines just incase...No luck//(*updater).boundObject = 0;updater = EmitterList.erase ( updater ); //Destroy it}}else //If it's not bound to an Object...{//--*snip*--//}}}and the getCurHealth function is simply...//--In xActor.h--//virtual int getCurHealth() { return iCurHealth; }Why does it decide to 'wack out' the pointer after a random amount of time, and why does the error line point to getCurHealth :| ?Thanks for your help :)   
  It sounds like you've accessed a member variable or called a member function of an object that has already been deleted.   ;  Just to clarify what Sicrane said, in Visual C++, in debug mode, when you delete something, the memory gets overwritten with 0xFEEEFEEE values. You can see it in the address of the variable being accessed: 0xFEEEFEF2 is 0xFEEEFEEE + 4.   ;  Ok, that would make sense,But why then if I make iCurHealth public and just access it directly does the error not occur?Edit: Ok, accessing it directly didn't actually stop the error, just postponed it for awhile. I ended up giving the enemies 10 updates before they were actually 'deleted' once their health hit < 0, that way the Emitter had time to delete itself before trying to access the deleted object :) You guys really are helpful :)[Edited by - 3Effex on June 16, 2006 10:09:40 PM];Quote:Original post by 3EffexEdit: Ok, accessing it directly didn't actually stop the error, just postponed it for awhile. I ended up giving the enemies 10 updates before they were actually 'deleted' once their health hit < 0, that way the Emitter had time to delete itself before trying to access the deleted object :) Uuhhh, you may want to rethink your design from scratch. Removing dead objects from the list of objects to update and then deleting them would be a good start.   