Dynamic Lights Cause Crash on Shutdown

NinjaSaru

08-05-2009 09:18:22

My app is crashing on shutdown and it seems to be related to the presence of dynamic lights. It's pretty easy to recreate using the demo app. In ETSample.cpp somewhere in DemoETSM::createScene(), add the following code (I put it right after configuration of the Camera but I don't think it matters).


mSceneMgr->getRootSceneNode()->createChildSceneNode("LightNode")->attachObject(mSceneMgr->createLight("Light"));


But if you point the camera away from the terrain so it never passes into view, and exit without ever looking at it, then the crash does not occur. But if you look at it at all, it still crashes. To test this I just changed the Camera start out looking straight up.

Any help would be great! Thanks!

NinjaSaru

08-05-2009 09:27:53

A little more detail on the crash...



Here is what my call stack looks like. As you can see, it appears to be dieing while destructing Tile::mLightList.

ntdll.dll!7c90120e()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
ntdll.dll!7c96e139()
ntdll.dll!7c96e576()
ntdll.dll!7c9622e8()
EditableTerrainManager_d.dll!std::_Destroy_range<Ogre::Light *,std::allocator<Ogre::Light *> >(Ogre::Light * * _First=0x06a47e88, Ogre::Light * * _Last=0x0012f4d4, std::allocator<Ogre::Light *> & _Al={...}) Line 226 + 0x2e bytes C++
EditableTerrainManager_d.dll!std::allocator<Ogre::Light *>::deallocate(Ogre::Light * * _Ptr=0x06a47e88, unsigned int __formal=1) Line 141 + 0x9 bytes C++
EditableTerrainManager_d.dll!std::vector<Ogre::Light *,std::allocator<Ogre::Light *> >::_Tidy() Line 1098 C++
EditableTerrainManager_d.dll!std::vector<Ogre::Light *,std::allocator<Ogre::Light *> >::~vector<Ogre::Light *,std::allocator<Ogre::Light *> >() Line 547 C++
EditableTerrainManager_d.dll!ET::Impl::Tile::~Tile() Line 76 + 0x40 bytes C++
EditableTerrainManager_d.dll!ET::Impl::Tile::`scalar deleting destructor'() + 0x2b bytes C++
EditableTerrainManager_d.dll!ET::Impl::TerrainImpl::destroyTerrain() Line 154 + 0x50 bytes C++
EditableTerrainManager_d.dll!ET::Impl::TerrainImpl::~TerrainImpl() Line 84 C++
EditableTerrainManager_d.dll!ET::Impl::TerrainImpl::`scalar deleting destructor'() + 0x2b bytes C++
EditableTerrainManager_d.dll!ET::TerrainManager::~TerrainManager() Line 335 + 0x2d bytes C++