[Lua] Life control fix for XMLHttpRequest

This commit is contained in:
James Chen 2015-09-12 17:49:30 +08:00
parent 4022fb65e1
commit 6073456f23
1 changed files with 3 additions and 8 deletions

View File

@ -206,8 +206,6 @@ void LuaMinXmlHttpRequest::_sendRequest()
}
long statusCode = response->getResponseCode();
char statusString[64] = {};
sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag());
if (!response->isSucceed())
{
@ -269,7 +267,6 @@ void LuaMinXmlHttpRequest::_sendRequest()
release();
});
network::HttpClient::getInstance()->sendImmediate(_httpRequest);
CC_SAFE_RELEASE_NULL(_httpRequest);
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)
{
LuaMinXmlHttpRequest* self = (LuaMinXmlHttpRequest*) tolua_tousertype(L,1,0);
Mtolua_delete(self);
self->release();
return 0;
}
@ -304,10 +301,8 @@ static int lua_cocos2dx_XMLHttpRequest_constructor(lua_State* L)
if (argc == 0)
{
self = new (std::nothrow) LuaMinXmlHttpRequest();
self->autorelease();
int ID = self? (int)self->_ID : -1;
int* luaID = self? &self->_luaID : NULL;
toluafix_pushusertype_ccobject(L, ID, luaID, (void*)self, "cc.XMLHttpRequest");
tolua_pushusertype(L, (void*)self, "cc.XMLHttpRequest");
tolua_register_gc(L, lua_gettop(L));
return 1;
}