add term logic of application to prevent memory leak (for desktop such as linux, mac, windows)

This commit is contained in:
Huabing.Xu 2013-09-18 17:16:31 +08:00
parent a2dee37b0e
commit 768828ec29
3 changed files with 23 additions and 2 deletions

View File

@ -60,7 +60,13 @@ int Application::run()
usleep((_animationInterval - iCurTime+iLastTime)*1000);
}
}
/* Only work on Desktop
* Director::mainLoop is really one frame logic
* when we want to close the window, we should call Director::end();
* then call Director::mainLoop to do release of internal resources
*/
Director::getInstance()->end();
Director::getInstance()->mainLoop();
return -1;
}

View File

@ -60,6 +60,14 @@ int Application::run()
Director::getInstance()->mainLoop();
pMainWnd->pollEvents();
}
/* Only work on Desktop
* Director::mainLoop is really one frame logic
* when we want to close the window, we should call Director::end();
* then call Director::mainLoop to do release of internal resources
*/
Director::getInstance()->end();
Director::getInstance()->mainLoop();
return true;
}

View File

@ -64,7 +64,14 @@ int Application::run()
Sleep(0);
}
}
/* Only work on Desktop
* Director::mainLoop is really one frame logic
* when we want to close the window, we should call Director::end();
* then call Director::mainLoop to do release of internal resources
*/
Director::getInstance()->end();
Director::getInstance()->mainLoop();
return true;
}