Skip to content

Commit

Permalink
Don't retain the MTLTexture or MTLDevice in TestMetalContext (#30832)
Browse files Browse the repository at this point in the history
  • Loading branch information
George Wright authored Jan 13, 2022
1 parent 742eaf8 commit d0f2beb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions testing/test_metal_context.mm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace flutter {

TestMetalContext::TestMetalContext() {
auto device = fml::scoped_nsprotocol{[MTLCreateSystemDefaultDevice() retain]};
auto device = fml::scoped_nsprotocol{MTLCreateSystemDefaultDevice()};
if (!device) {
FML_LOG(ERROR) << "Could not acquire Metal device.";
return;
Expand Down Expand Up @@ -82,8 +82,7 @@
}

id<MTLDevice> device = (__bridge id<MTLDevice>)GetMetalDevice();
sk_cfp<void*> texture =
sk_cfp<void*>{[[device newTextureWithDescriptor:texture_descriptor.get()] retain]};
sk_cfp<void*> texture = sk_cfp<void*>{[device newTextureWithDescriptor:texture_descriptor.get()]};

if (!texture) {
FML_CHECK(false) << "Could not create texture from texture descriptor.";
Expand Down

0 comments on commit d0f2beb

Please sign in to comment.