Original Post
Ok... I have a system for attaching particle systems to objects in my game... basically all objects in the game are derived from a GameObject class that stores a position (among other things), and then I have particle systems which can be ''attached'' to game objects via a pointer to the game object (and can there by access the objects position anytime it wants)... the particle system then uses the location of the game object when spawning particles and whatnot... this allows for smoke trails and all kinds of good stuff, no matter where the object moves... it works pretty well... except when it comes to deleting objects that die... the pointer to the game object in the particle system becomes invalid and crashes because it points to unallocated memory immediatly after the object is deleted...
is there anyway to detect if a pointer is bad? or what would be a better way of handling this simply? I have a few ideas, like giving game objects unique IDs which can be used to retrieve a pointer to the object if it exists... I''d like to know what other people think...