diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm index dc91dde315..c29c749164 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm @@ -4,6 +4,7 @@ #include "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h" +#include "flutter/fml/platform/darwin/cf_utils.h" #include "flutter/shell/platform/darwin/ios/ios_surface.h" static int kMaxPointsInVerb = 4; @@ -132,15 +133,14 @@ void ResetAnchor(CALayer* layer) { } - (void)clipPath:(const SkPath&)path { - CGMutablePathRef pathRef = CGPathCreateMutable(); if (!path.isValid()) { return; } + fml::CFRef pathRef(CGPathCreateMutable()); if (path.isEmpty()) { CAShapeLayer* clip = [[CAShapeLayer alloc] init]; clip.path = pathRef; self.layer.mask = clip; - CGPathRelease(pathRef); return; } @@ -198,7 +198,6 @@ void ResetAnchor(CALayer* layer) { CAShapeLayer* clip = [[CAShapeLayer alloc] init]; clip.path = pathRef; self.layer.mask = clip; - CGPathRelease(pathRef); } - (void)setClip:(flutter::MutatorType)type