diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm index dc91dde315463..c29c7491641d1 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm +++ b/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)clipRRect:(const SkRRect&)clipSkRRect { } - (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)clipPath:(const SkPath&)path { CAShapeLayer* clip = [[CAShapeLayer alloc] init]; clip.path = pathRef; self.layer.mask = clip; - CGPathRelease(pathRef); } - (void)setClip:(flutter::MutatorType)type