Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Galileo430

Deleting pointer issues.

This topic is 5734 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

I''ve tried to figure this one out and I''m stumped. It seems like something REALLY messed up is going on. In my graphics engine I kept getting this issue where I would delete a pointer which seemed to be valid (not NULL or 0xcdcdcdcd) and it would crash in one of delete''s sub functions Callstack: CFEModel::''Scalar deleting destructor''(Unsigned Int) operator delete (void*) free (void*) free_dbg (void*) Originally I thought it must be a error in CFEModel''s destructor. However the destrutor is EMPTY. So then I thought maybe I changed the pointer. So I checked. From the time I called "new" to when I called "delete" the pointers value didn''t change. So then I thought I must have deleted it somewhere else and not set it back to NULL so I wouldn''t release it again. So. I did a test. I put the following code in my engine.
  
m_SceneObjects = new CFEModel[modelCount];
m_SceneLights = new CFELight[lightCount];

delete m_SceneObjects; // <---- Crashed Here

delete m_SceneLights; 

  
It crashed, same call stack right where I noted.. I''m totally stumped.. I''m having a bad week. Thanks for you help.

Share this post


Link to post
Share on other sites
Advertisement
you want the array form of delete:

  
m_SceneObjects = new CFEModel[modelCount];
m_SceneLights = new CFELight[lightCount];
delete []m_SceneObjects; // <---- Crashed Here

delete []m_SceneLights;

That may not fix your error though, but it''s a place to start.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!