Manually retain/release mPendingCommands (#208)

Fixes a crash for me on macOS+Metal
This commit is contained in:
Kai Ninomiya 2018-07-03 12:19:28 -07:00 committed by GitHub
parent f53f98bf86
commit 66c06f42f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -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<MTLCommandBuffer> 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++;
}