diff --git a/cocos/scripting/lua-bindings/manual/network/lua_xml_http_request.cpp b/cocos/scripting/lua-bindings/manual/network/lua_xml_http_request.cpp index df1514c1c5..0c77a3f268 100644 --- a/cocos/scripting/lua-bindings/manual/network/lua_xml_http_request.cpp +++ b/cocos/scripting/lua-bindings/manual/network/lua_xml_http_request.cpp @@ -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; }