I'm trying to design a multi-document Mac application. I'm guessing that there should be one instance of Root, and maybe OverlaySystem, but that most other things should be per-document: Window, Camera, CompositorWorkspace, SceneManager. So when the document goes away, I want to clean up all the per-document data:
Code: Select all
_ogreSceneManager->destroyCamera( _ogreCamera );
Ogre::Root::getSingleton().destroySceneManager( _ogreSceneManager );
Ogre::Root::getSingleton().getCompositorManager2()->removeWorkspace( _ogreWorkspace );
Ogre::Root::getSingleton().getRenderSystem()->destroyRenderWindow( _ogreWindow );
The problem is that when I remove the workspace, I get a fatal exception, with the backtrace:
Code: Select all
void Ogre::SceneManager::checkMovableObjectIntegrity<Ogre::Camera>
Ogre::SceneManager::destroyCamera
Ogre::CompositorShadowNode::~CompositorShadowNode
Ogre::CompositorWorkspace::destroyAllNodes
Ogre::CompositorWorkspace::~CompositorWorkspace
Ogre::CompositorManager2::removeWorkspace
Do I need to do something more to clean up a shadow node? I had tried to imitate Sample_ShadowMapFromCode, and I must admit to a pretty darn fuzzy understanding of how compositors and shadow nodes work. It looks like there is a very loose connection between a shadow node and a CompositorWorkspace, and I don't see any public API methods in CompositorWorkspace having to do with removing or destroying a shadow node.