Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Access Violation

Author
Message
Ultimate_H
15
Years of Service
User Offline
Joined: 11th Mar 2009
Location: A place that is neither here nor there
Posted: 29th Oct 2009 08:40 Edited at: 29th Oct 2009 08:44
Okay, I have been having an issue with a program I am working on, and for some reason after the final return in "void DarkGDK(void)" I am getting an access violation error, and have no idea why.
Here is an image of the error box:


The problem is that when I choose "Break", it tells me that there is no source code that it can direct me to and just pauses.

If anyone has encountered this before, or knows what is happening, any help would be great. I would post the code but it is across many files and not commented at all.

p.s: should I call dbDeleteObject(ID) inside a class destructor if i am not controlling the class with a pointer?

EDIT: I guess I should test my "theories". Tip to anyone/everyone out there who decides to delete objects in class destructors: DON'T. I fixed it by getting rid of the deleting in the destructors.

I am not smart. I am not powerful. I am just a guy. I am strengthened through my faith.
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 29th Oct 2009 09:23 Edited at: 29th Oct 2009 09:23
There's nothing wrong with deleting objects in a destructor, the issue is the order its called in. If you return from the entry point then GDK will get deallocated before any allocated objects are destroyed so you'll end up telling GDK to delete objects that don't exist, to fix this just destroy all your objects(classes/structs) yourself before leaving the entry point.

Ultimate_H
15
Years of Service
User Offline
Joined: 11th Mar 2009
Location: A place that is neither here nor there
Posted: 29th Oct 2009 09:43
Is there a way to call the object's destructor, before returning from the entry point, without it being owned by a pointer? (meaning "SomeObj Object" and not "SomeObj* Object") or should I only put a "deletor" inside of objects controlled by pointers?

I am not smart. I am not powerful. I am just a guy. I am strengthened through my faith.
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 29th Oct 2009 11:02
Why would you have an object that isn't referenced by anything?

Ultimate_H
15
Years of Service
User Offline
Joined: 11th Mar 2009
Location: A place that is neither here nor there
Posted: 29th Oct 2009 18:59
Which kind of object are you referring to? 3D objects? or OOP Objects?

If your talking about OOP Objects, I like to complete the class and have it work before I start referring to them using pointers.

If your talking about 3D objects, I don't have objects that are not referenced by anything.

I am not smart. I am not powerful. I am just a guy. I am strengthened through my faith.

Login to post a reply

Server time is: 2024-10-01 16:29:29
Your offset time is: 2024-10-01 16:29:29