fixed #306, invoke CCDirector::end() method in next msgloop, otherwise the flow will crashes when end() is called in an ActionInterval.

This commit is contained in:
walzer 2011-01-17 22:01:15 +08:00
parent 04c685b95a
commit e399a77369
2 changed files with 17 additions and 3 deletions

View File

@ -459,6 +459,8 @@ protected:
* mobile platforms specific functions
**************************************************/
void purgeDirector();
bool m_bPurgeDirecotorInNextLoop; // this flag will be set to true in end()
bool isOpenGLAttached(void);
void updateContentScaleFactor(void);

View File

@ -107,6 +107,9 @@ bool CCDirector::init(void)
// paused ?
m_bPaused = false;
// purge ?
m_bPurgeDirecotorInNextLoop = false;
m_obWinSizeInPixels = m_obWinSizeInPoints = CGSizeZero;
// default values
@ -535,7 +538,12 @@ void CCDirector::popScene(void)
}
}
void CCDirector::end(void)
void CCDirector::end()
{
m_bPurgeDirecotorInNextLoop = true;
}
void CCDirector::purgeDirector()
{
// don't release the event handlers
// They are needed in case the director is run again
@ -926,7 +934,11 @@ void CCDisplayLinkDirector::startAnimation(void)
void CCDisplayLinkDirector::mainLoop(void)
{
if (! m_bInvalid)
if (m_bPurgeDirecotorInNextLoop)
{
purgeDirector();
}
else if (! m_bInvalid)
{
drawScene();