Crash on deleting a scene

uberglitch

15-11-2007 01:40:05

Hi again, I'm using a custom Character class of the form:


class PlayerCharacter : public NxOgre::Character { .... }


and creating the character like so:


player = (PlayerCharacter*)mScene->createCharacter(name, Vector3(x, y, z), "type: box, dimensions: 1 2 1, Group: player");
player->setVariableX();
player->setVariableY();
player->blah blah...


but when it comes time to delete it, using:


//NxOgre clean up
if(world){
world->getScenes()->destroyAllOwned();
}


My program crashes on the world->getScenes... line. The same thing happens when I use "delete mScene";

The particular error I get is:
HEAP[WIP.exe]: Heap block at 07275618 modified at 072756F4 past requested size of d0. Which says to me that it's unable to delete my custom character, but I can't be sure.

Any advice?
Thanks,
Uberglitch

jchmack

15-11-2007 07:58:14

Couldn't you delete your character yourself rather than just letting nxogre do it at the end? Your going to want to do this yourself anyways or else you won't reclaim your character memory until your app closes. just call delete player before you call destroyAllOwned(); The built in destructor for character should take care of the base character class.