closed #4568: Application crashes on closing if CC_ENABLE_CACHE_TEXTURE_DATA is enabled.
CC_SAFE_RELEASE(_eventDispatcher); should be after 'delete _renderer;'
in Director's destructor.
Makes 'compareRenderCommand' as a static function instead of a global function
Merge pull request #6304 from dumganhar/iss4568-crash

closed #4568: Application crashes on closing if CC_ENABLE_CACHE_TEXTURE_DATA is enabled.