我发现 cocos2dx 4.0 版本在 Mac 系统(版本:13.0.1)下的一个 BUG
当点击窗口左上方的关闭系统的按钮来关闭程序时,会产生一个 EXC_BAD_ACCESS
发生的位置在 cocos2d/cocos/renderer/backend/metal/CommandBufferMTL.mm 文件的 368 行,修改方式需要将下面这段代码
[_mtlCommandBuffer addCompletedHandler:^(id<MTLCommandBuffer> commandBuffer) {
// GPU work is complete
// Signal the semaphore to start the CPU work
dispatch_semaphore_signal(_frameBoundarySemaphore);
}];
修改为
[_mtlCommandBuffer addCompletedHandler:^(id<MTLCommandBuffer> commandBuffer) {
// GPU work is complete
// Signal the semaphore to start the CPU work
if (_frameBoundarySemaphore != nil) {
dispatch_semaphore_signal(_frameBoundarySemaphore);
}
}];