Crash, even with shutdown(false)

Dalon

06-02-2009 17:10:30

Hi,

I have a problem with destroying CaelumSystem. Well, I do it as described in the "tutorial" etc. by calling

m_pSkySysten->shutdown(false);
m_pSkySystem = NULL;


Well, my problem is, that the whole application crashes, when the next frame is tried to be rendered...
Ogre.log:

18:05:46: Caelum: Shutting down Caelum system...
18:05:46: Caelum: Delete UniversalClock
>... some own messages...<
18:05:47: Caelum: Delete UniversalClock
18:05:47: Caelum: CaelumSystem destroyed.


If I just close the application by "return false;" in frameStarted in the main framelistener of my application,
anything works just fine, no crash...

Did I miss something?

I use these components when I initialize Caelum...

CAELUM_COMPONENT_SUN
CAELUM_COMPONENT_MOON
CAELUM_COMPONENT_SKY_DOME
CAELUM_COMPONENT_POINT_STARFIELD

And this is called after successfully initializing Caelum...

Root::getSingletonPtr()->getAutoCreatedWindow()->addListener(m_pSkySystem);
Root::getSingletonPtr()->addFrameListener(m_pSkySystem);


Any ideas? =/

cdleonard

11-03-2009 05:58:12

I blame the following:

Root::getSingletonPtr()->getAutoCreatedWindow()->addListener(m_pSkySystem);


CaelumSystem will not remove itself from the window listener list; I'm not even sure that's possible. It would probably involve looping over all created windows.

Try to remove CaelumSystem as a RenderTargetListener before shutdown(false); it should fix your immediate problem.

Adding CaelumSystem as a RenderTargetListener will not correctly fix all flickering issues; it's better to call notifyCameraChanged manually. See the long painful discussion in CaelumSystem docs for more about this issue.