mirror of https://github.com/axmolengine/axmol.git
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:
parent
04c685b95a
commit
e399a77369
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue