[Help] Deleting paging landscape

Creajeux_Progs

25-01-2007 15:43:52

I can't find a solution to delete the Paging Landscape scenemanager ...

Here is the problem :

There is a frame listener called PagingLandscapePageManager (or something like that..) which is called every frame.

When i delete the scene manager from my application, this frame listener is put in a "ToDestroy" list of framelistener but, as it is still in the list of "ToCall" frame listener, its called on the same frame, but no longer exists. .so it crash..

I hope you understand me (not easy to explain a complex problem in english :p )

Basically there is 2 frame listener to call : the application one and this paging listener (called after the application listener), so when i destroy the latter during the former, it still want to call the paging one in the same frame.

How can i resolve this ? i don't see how to delete a frame listener the next frame..

kungfoomasta

25-01-2007 18:14:29

Maybe try Ogre::Root::removeFrameListener?

KungFooMasta

Creajeux_Progs

26-01-2007 09:25:15

It would be too easy..

here is the code of OgreRoot :
void Root::removeFrameListener(FrameListener* oldListener)
{
// Remove, 1 only (set)
mRemovedFrameListeners.insert(oldListener);
}
//-----------------------------------------------------------------------
bool Root::_fireFrameStarted(FrameEvent& evt)
{
// Increment frame number
++mCurrentFrame;

// Remove all marked listeners
std::set<FrameListener*>::iterator i;
for (i = mRemovedFrameListeners.begin();
i != mRemovedFrameListeners.end(); i++)
{
mFrameListeners.erase(*i);
}
mRemovedFrameListeners.clear();

// Tell all listeners
for (i= mFrameListeners.begin(); i != mFrameListeners.end(); ++i)
{
if (!(*i)->frameStarted(evt))
return false;
}

return true;

}


As you can see, removeframe listener put the listener in the list which will be realy deleted the frame after in fireframestarted function.
But as i said, the application famre listener is called in the "for" and delete the PLSM, so in th same "for", this plsm frame listener is also called but doesn't exist anymore.