diff --git a/cocos/2d/CCFontAtlas.cpp b/cocos/2d/CCFontAtlas.cpp index ee13d13..17336c9 100644 --- a/cocos/2d/CCFontAtlas.cpp +++ b/cocos/2d/CCFontAtlas.cpp @@ -125,11 +125,12 @@ FontAtlas::~FontAtlas() releaseTextures(); delete []_currentPageData; + CC_SAFE_DELETE_ARRAY(_currentPageDataRGBA); #if CC_TARGET_PLATFORM != CC_PLATFORM_WIN32 && CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID if (_iconv) { - iconv_close(_iconv); + iconv_close((iconv_t)_iconv); _iconv = nullptr; } #endif @@ -248,7 +249,7 @@ void FontAtlas::conversionU32TOGB2312(const std::u32string& u32Text, std::unorde #else if (_iconv == nullptr) { - _iconv = iconv_open("GBK//TRANSLIT", "UTF-32LE"); + _iconv = (void *)iconv_open("GBK//TRANSLIT", "UTF-32LE"); } if (_iconv == (iconv_t)-1) @@ -262,7 +263,7 @@ void FontAtlas::conversionU32TOGB2312(const std::u32string& u32Text, std::unorde size_t inLen = strLen * 2; size_t outLen = gb2312StrSize; - iconv(_iconv, (char**)&pin, &inLen, &pout, &outLen); + iconv((iconv_t)_iconv, (char**)&pin, &inLen, &pout, &outLen); } #endif } diff --git a/tests/src/app/views/Test_FairyGUI.lua b/tests/src/app/views/Test_FairyGUI.lua index 9fa219d..3e574ef 100755 --- a/tests/src/app/views/Test_FairyGUI.lua +++ b/tests/src/app/views/Test_FairyGUI.lua @@ -17,10 +17,13 @@ function TestCase:ctor() -- btn event, fairy has it's own EventDispatcher, cover the cocos's node local btn = view:getChild("n9") btn:addEventListener(fairygui.UIEventType.Click, function(context) - self.fairyRoot:release() - -- XXX:场景切换的时候需要释放fairygui的静态数据,避免不必要的异常 - fairygui.HtmlObject:clearStaticPools() - fairygui.DragDropManager:destroyInstance() + -- 不能在fgui事件里面做删除自己等操作,内部会崩. + self:performWithDelay(function() + self.fairyRoot:release() + -- XXX:场景切换的时候需要释放fairygui的静态数据,避免不必要的异常 + fairygui.HtmlObject:clearStaticPools() + fairygui.DragDropManager:destroyInstance() + end, 0) end) local btnOpenWin = view:getChild("btnOpenWin")