Open spring-zh opened 4 years ago
I have the same issue. I think this crash is produced only when the App is run via Xcode. So, If Metal API Validation is unchecked in Xcode (Product>Scheme>Edit Scheme>Run>Diagnostics>Metal API Validation), this crash never happen.
So, I don't know this should be fixed or not.
this crash never happen.
Sorry, some old devices, such as iPad mini 2nd, still crash even if the Metal API Validation is unchecked.
To avoid this crash, I edited "DepthStencilStateMTL.mm" like below as it's mentioned here https://github.com/cocos2d/cocos2d-x/issues/20453#issuecomment-643107153
DepthStencilStateMTL::~DepthStencilStateMTL()
{
//[_mtlDepthStencilState release];
_mtlDepthStencilState = nil;
}
then crash never happenes.
@devekaam in my testing removing [_mtlDepthStencilState release];
caused a memory leak (confirmed in Instruments). The underlying cause of the crash was elsewhere, in my code not in Cocos2d-x, and running with Guard Malloc pinpointed it.
it occurred to me too
Steps to Reproduce: