From a00d594ba0ca5d7af3418c0551f292094004330a Mon Sep 17 00:00:00 2001 From: halx99 Date: Thu, 23 Feb 2023 21:59:00 +0800 Subject: [PATCH] Fix live2d sdk crash issue --- .../src/Rendering/axmol/CubismCommandBuffer_Cocos2dx.cpp | 7 ++++--- .../src/Rendering/axmol/CubismCommandBuffer_Cocos2dx.hpp | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/Live2D/Framework/src/Rendering/axmol/CubismCommandBuffer_Cocos2dx.cpp b/extensions/Live2D/Framework/src/Rendering/axmol/CubismCommandBuffer_Cocos2dx.cpp index abc0554fd3..669ff909c8 100644 --- a/extensions/Live2D/Framework/src/Rendering/axmol/CubismCommandBuffer_Cocos2dx.cpp +++ b/extensions/Live2D/Framework/src/Rendering/axmol/CubismCommandBuffer_Cocos2dx.cpp @@ -108,7 +108,6 @@ CubismCommandBuffer_Cocos2dx::DrawCommandBuffer::DrawCommand* CubismCommandBuffe CubismCommandBuffer_Cocos2dx::CubismCommandBuffer_Cocos2dx() :_currentColorBuffer(NULL) { - _groupCommand.init(0.0); } CubismCommandBuffer_Cocos2dx::~CubismCommandBuffer_Cocos2dx() @@ -117,8 +116,10 @@ CubismCommandBuffer_Cocos2dx::~CubismCommandBuffer_Cocos2dx() void CubismCommandBuffer_Cocos2dx::PushCommandGroup() { - GetCocos2dRenderer()->addCommand(&_groupCommand); - GetCocos2dRenderer()->pushGroup(_groupCommand.getRenderQueueID()); + auto groupCommand = GetCocos2dRenderer()->getNextGroupCommand(); + groupCommand->init(0.0); + GetCocos2dRenderer()->addCommand(groupCommand); + GetCocos2dRenderer()->pushGroup(groupCommand->getRenderQueueID()); } void CubismCommandBuffer_Cocos2dx::PopCommandGroup() diff --git a/extensions/Live2D/Framework/src/Rendering/axmol/CubismCommandBuffer_Cocos2dx.hpp b/extensions/Live2D/Framework/src/Rendering/axmol/CubismCommandBuffer_Cocos2dx.hpp index 455b72e23b..fa2c63fdd3 100644 --- a/extensions/Live2D/Framework/src/Rendering/axmol/CubismCommandBuffer_Cocos2dx.hpp +++ b/extensions/Live2D/Framework/src/Rendering/axmol/CubismCommandBuffer_Cocos2dx.hpp @@ -160,7 +160,6 @@ private: backend::TextureBackend* _currentColorBuffer; OperationStateData _operationStateArray[OperationType_TypeMax]; - ax::GroupCommand _groupCommand; }; }}}}