From 66c06f42f436cd4b75ffc2731633a0e65f457aae Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Tue, 3 Jul 2018 12:19:28 -0700 Subject: [PATCH] Manually retain/release mPendingCommands (#208) Fixes a crash for me on macOS+Metal --- src/backend/metal/DeviceMTL.mm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/backend/metal/DeviceMTL.mm b/src/backend/metal/DeviceMTL.mm index 368615cedd..98aa3c6c47 100644 --- a/src/backend/metal/DeviceMTL.mm +++ b/src/backend/metal/DeviceMTL.mm @@ -66,7 +66,8 @@ namespace backend { namespace metal { } Tick(); - mPendingCommands = nil; // This will be autoreleased. + [mPendingCommands release]; + mPendingCommands = nil; delete mMapTracker; mMapTracker = nullptr; @@ -155,6 +156,7 @@ namespace backend { namespace metal { id Device::GetPendingCommandBuffer() { if (mPendingCommands == nil) { mPendingCommands = [mCommandQueue commandBuffer]; + [mPendingCommands retain]; } return mPendingCommands; } @@ -174,7 +176,8 @@ namespace backend { namespace metal { }]; [mPendingCommands commit]; - mPendingCommands = nil; // This will be autoreleased. + [mPendingCommands release]; + mPendingCommands = nil; mPendingCommandSerial++; }