Reverts changes in CCApplication.cpp/.mm, pollEvent must after main loop, otherwise, potential crash will happen.

Reverts changes in https://github.com/cocos2d/cocos2d-x/pull/5803.