Error: Bad reference counting?
Error: Bad reference counting?
I'm trying to use my own linked list class to manage objects in Irrlicht. The actual error message I get is an access violation error but it points me to an Irrlich header. A comment there claims I'm doing bad reference counting? I don't even know what that is. My linked list code is sound, I've used it before. Is there something I have to do when dynamically allocating nodes in Irrlicht? The error seems to occur only if I drop the nodes I create?
I recommend looking at the documentation for ISceneManager and notice the difference between calls with add and create in their names, and what it says about drop().
The basic rule is : create functions don't grab() the object, add functions do.
So, If you call :
after a successful return from the function, the ref count of the animator is 1. Now, when you call
This function for a node, will associate the animator with the node, and since the node relies on the animator's data, it will call grab() on the animator. So now, after a successful return from this function the animator's reference count is 2. If you no longer need the animator for anything else, you call drop() on it, so that when the sceneNode is done, and it calls drop on the animator( which it will, since it grabbed it ), the animtor will be destroyed and you don't have to worry about it.
There's tons of documentation about all of this. Look at IUnknown and ISceneManager.
The basic rule is : create functions don't grab() the object, add functions do.
So, If you call :
Code: Select all
anim = createXXXAnimator(...);
Code: Select all
node->addAnimator(anim);
There's tons of documentation about all of this. Look at IUnknown and ISceneManager.
-
- Posts: 370
- Joined: Mon Aug 29, 2005 10:54 pm
- Location: http://web.utk.edu/~pfox1