Fix CGMutablePathRef memory leaks when the path is invalid. (flutter/engine#14275)
This commit is contained in:
@@ -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<CGMutablePathRef> 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
|
||||
|
||||
Reference in New Issue
Block a user