Crash when game shuts down

dbrock

04-12-2007 09:25:19

After calling 'delete mWorld' my game crashes. The html log file says the following:


PhysX Error (NXE_INVALID_OPERATION) 'PhysicsSDK::releaseHeightField: instances of this heightfield still exist!' in line 651 of g:\scm\release\PhysX_2.7.2\novodex\SDKs\Physics\src\NpPhysicsSDK.cpp


this is my ground terrain code which works fine:

Ogre::Real terrainHeight = ( mTerrainInfo->getExtents().getMaximum() - mTerrainInfo->getExtents().getMinimum() ).y;

Ogre::Vector3 terrainScale;
terrainScale.x = (float)(1500.0f/129.0f);
terrainScale.z = (float)(1500.0f/129.0f);
Ogre::String stringTerrainScale = "mesh-scale: " + Ogre::StringConverter::toString(terrainScale.x) + " 1 " + Ogre::StringConverter::toString(terrainScale.z);

NxOgre::Actor* terrainActor = mPhysScene->createActor(
"Terrain", // ID
new NxOgre::TerrainShape("../media/ET/ETTerrain.png", terrainHeight, stringTerrainScale), // Shape blueprint
Ogre::Vector3::ZERO, // Pose
"static: yes" // Parameters
);


Am I forgetting to clean something up?

betajaen

04-12-2007 09:27:26

That isn't the reason why it's crashing, it's something else.

dbrock

04-12-2007 18:32:21

It's strange, it's only crashing when the game shuts down. When you delete mWorld, it's taking care of free'ing up everything, correct?

betajaen

04-12-2007 18:48:00

Yes. Can you run the Visual Studio debugger on your application and shut it down, then post a code snippet/file/line to the cause of the crash?

dbrock

06-12-2007 04:56:36

Would this seem like it would cause a crash:


mSceneMgr->clearScene();
mPhysWorld->destroyScene("MainPhysWorld");


I'm assuming mPhysWorld can't delete itself, nor clear the NxOgre::Scene because the scene manager that was passed to it was already cleared on the line before?

The reason I'm not deleting mPhysWorld, is because when the level editor quits, the game goes to the main menu, so it's not exactly shutting down.