From c16c53c12dec642cf772874f168eec29fca48cd0 Mon Sep 17 00:00:00 2001 From: u0u0 Date: Thu, 9 Nov 2023 14:25:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3xcode15=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=AD=A3=E5=86=85=E5=AD=98=E6=B3=84=E6=BC=8F?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cocos/2d/CCFontAtlas.cpp | 7 ++++--- tests/src/app/views/Test_FairyGUI.lua | 11 +++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) 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")