Sign in to follow this  

Messy pointer problem.. (fixed)

This topic is 4481 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello. I have a class, with coordinates for X, Y, and Z. I attached a particle system to an instance of that class by doing something like this.. class Object{ int X; }; class ParticleSystem{ int *X; }; then I do.. PSInstance->X=&OInstance.X; etc, which, as expected, binds the two X values, changing ParticleSystem's X value automatically when Object's X value changes. So far so good. Now, I want to get rid of Object, and I don't know what instance of the particle system is using it... So I figure I'll check if the X,Y, and Z are valid values, that ought to tell me whether or not Object has been deleted. But... I try if (PSInstance->X==NULL){ } but it doesn't return true, when the object with the connected X value is deleted.. Please help, how do I tell when the pointer becomes invalid? Thanks. Adam [Edited by - Adams555 on September 5, 2005 8:21:02 PM]

Share this post


Link to post
Share on other sites
Heh.. I REALLY should have thought of registering the instance in my class before. Reguardless, it works very nicely now.. just made and destroyed around 1k of those objects, with no noticable loss of performance :)

Thanks again,

Adam

Share this post


Link to post
Share on other sites

This topic is 4481 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this