About Store Forum Documentation Contact



Post Reply 
game crash on objcreatenear
Author Message
yvanvds Offline
Member

Post: #1
game crash on objcreatenear
Hello again

This is hard to debug, because for some reason it happens only in release mode:

I dynamically create objects with Game::World.objCreateNear. It works and I can place all types of objects with it. But if I delete all existing objects of a certain type and then add an object of that type again, my game crashes.

By adding log messages in every function, I discovered that the create function of the object is not called this time, but Game::World.objCreateNear returns a valid pointer. (Well of course it isn't valid, hence the crash, but it should return a NULL pointer if the object doesn't get created.)

Perhaps something in my code is also wrong, but in any case I should get a NULL pointer, no?

To wrap it up:
* objCreateNear is called from my program.
* it does not call the create function of my object.
* it returns a (seemingly) valid pointer.

Regards,

yvan

Edit: And even if i would get a NULL pointer, i can't see why the object should not be created. The location is near to the camera, about the same spot as the previous objects. I would understand if there went something wrong in my create function of the object itself, but that does never get called...
(This post was last modified: 12-18-2011 04:55 PM by yvanvds.)
12-18-2011 04:47 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: game crash on objcreatenear
create is always called before returning pointer to object
most likely you have some buggy codes wink
12-18-2011 05:39 PM
Find all posts by this user Quote this message in a reply
yvanvds Offline
Member

Post: #3
RE: game crash on objcreatenear
I hate it when you're right...

(I made some changes to an ObjParamsPtr someplace else instead of copying the contents to ObjParams first, that resulted in the wrong kind of object created.)
12-18-2011 07:32 PM
Find all posts by this user Quote this message in a reply
Post Reply