Fix CCDownloader-curl will crash in js-test

Fix broken image link in TextureCacheTest.js
This commit is contained in:
XiaoFeng 2015-10-20 16:28:03 +08:00
parent 83a48ee501
commit 7e54a91ee6
3 changed files with 8 additions and 5 deletions

View File

@ -698,6 +698,7 @@ namespace cocos2d { namespace network {
DownloaderCURL::DownloaderCURL(const DownloaderHints& hints)
: _impl(std::make_shared<Impl>())
, _currTask(nullptr)
, _breakScheduleFunc(false)
{
DLLOG("Construct DownloaderCURL %p", this);
_impl->hints = hints;
@ -731,6 +732,7 @@ namespace cocos2d { namespace network {
DownloaderCURL::~DownloaderCURL()
{
_breakScheduleFunc = true;
_scheduler->unschedule(_schedulerKey, this);
_scheduler->release();
@ -845,7 +847,7 @@ namespace cocos2d { namespace network {
DLLOG(" DownloaderCURL: finish Task: Id(%d)", coTask.serialId);
}
if (_impl->stoped())
if (!_breakScheduleFunc && _impl->stoped())
{
_scheduler->pauseTarget(this);
}

View File

@ -55,6 +55,7 @@ namespace cocos2d { namespace network
void _onSchedule(float);
std::string _schedulerKey;
Scheduler* _scheduler;
bool _breakScheduleFunc;
};
}} // namespace cocos2d::network

View File

@ -79,9 +79,9 @@ var TextureLoadImgTest = TextureCacheTestBase.extend({
});
this.addChild(this._labelSecond, 1);
var url = "http://cn.cocos2d-x.org/image/logo.png";
var url = "http://www.cocos2d-x.org/images/logo.png";
cc.textureCache.addImageAsync(url, this.texFirstLoaded, this);
cc.textureCache.addImageAsync(url, this.texSecondLoaded, this);
//cc.textureCache.addImageAsync(url, this.texSecondLoaded, this);
},
texFirstLoaded: function(texture) {
@ -264,7 +264,7 @@ var TextureCacheTest = TextureCacheTestBase.extend({
var RemoteTextureTest = TextureCacheTestBase.extend({
_title:"Remote Texture Test",
_subtitle:"",
_remoteTex: "http://cn.cocos2d-x.org/image/logo.png",
_remoteTex: "http://www.cocos2d-x.org/images/logo.png",
onEnter:function () {
this._super();
if('opengl' in cc.sys.capabilities && !cc.sys.isNative){
@ -277,7 +277,7 @@ var RemoteTextureTest = TextureCacheTestBase.extend({
},
startDownload: function() {
var imageUrlArray = ["http://www.cocos2d-x.org/s/upload/v35.jpg", "http://www.cocos2d-x.org/s/upload/testin.jpg", "http://www.cocos2d-x.org/s/upload/geometry_dash.jpg", "http://cn.cocos2d-x.org/image/logo.png"];
var imageUrlArray = ["http://www.cocos2d-x.org/s/upload/v35.jpg", "http://www.cocos2d-x.org/s/upload/testin.jpg", "http://www.cocos2d-x.org/s/upload/geometry_dash.jpg", "http://www.cocos2d-x.org/images/logo.png"];
for (var i = 0; i < imageUrlArray.length; i++) {
cc.textureCache.addImageAsync(imageUrlArray[i], this.texLoaded, this);