mirror of https://github.com/axmolengine/axmol.git
[Lua] Life control fix for XMLHttpRequest
This commit is contained in:
parent
4022fb65e1
commit
6073456f23
|
@ -206,8 +206,6 @@ void LuaMinXmlHttpRequest::_sendRequest()
|
||||||
}
|
}
|
||||||
|
|
||||||
long statusCode = response->getResponseCode();
|
long statusCode = response->getResponseCode();
|
||||||
char statusString[64] = {};
|
|
||||||
sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag());
|
|
||||||
|
|
||||||
if (!response->isSucceed())
|
if (!response->isSucceed())
|
||||||
{
|
{
|
||||||
|
@ -269,7 +267,6 @@ void LuaMinXmlHttpRequest::_sendRequest()
|
||||||
release();
|
release();
|
||||||
});
|
});
|
||||||
network::HttpClient::getInstance()->sendImmediate(_httpRequest);
|
network::HttpClient::getInstance()->sendImmediate(_httpRequest);
|
||||||
CC_SAFE_RELEASE_NULL(_httpRequest);
|
|
||||||
retain();
|
retain();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +284,7 @@ static void lua_reg_xml_http_request(lua_State* L)
|
||||||
static int lua_collect_xml_http_request (lua_State* L)
|
static int lua_collect_xml_http_request (lua_State* L)
|
||||||
{
|
{
|
||||||
LuaMinXmlHttpRequest* self = (LuaMinXmlHttpRequest*) tolua_tousertype(L,1,0);
|
LuaMinXmlHttpRequest* self = (LuaMinXmlHttpRequest*) tolua_tousertype(L,1,0);
|
||||||
Mtolua_delete(self);
|
self->release();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,10 +301,8 @@ static int lua_cocos2dx_XMLHttpRequest_constructor(lua_State* L)
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
{
|
{
|
||||||
self = new (std::nothrow) LuaMinXmlHttpRequest();
|
self = new (std::nothrow) LuaMinXmlHttpRequest();
|
||||||
self->autorelease();
|
tolua_pushusertype(L, (void*)self, "cc.XMLHttpRequest");
|
||||||
int ID = self? (int)self->_ID : -1;
|
tolua_register_gc(L, lua_gettop(L));
|
||||||
int* luaID = self? &self->_luaID : NULL;
|
|
||||||
toluafix_pushusertype_ccobject(L, ID, luaID, (void*)self, "cc.XMLHttpRequest");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue