[ios] Fix memory leak in ChildClippingView (flutter/engine#50389)
This fixes the memory leak in `ChildClippingView`. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
@@ -24,4 +24,6 @@ TheOneWithTheBraid <the-one@with-the-braid.cf>
|
||||
Twin Sun, LLC <google-contrib@twinsunsolutions.com>
|
||||
Qixing Cao <qixing.cao.83@gmail.com>
|
||||
LinXunFeng <linxunfeng@yeah.net>
|
||||
Amir Panahandeh <amirpanahandeh@gmail.com>
|
||||
Amir Panahandeh <amirpanahandeh@gmail.com>
|
||||
Rulong Chen(陈汝龙)<rulong.crl@alibaba-inc.com>
|
||||
|
||||
|
||||
@@ -246,6 +246,17 @@ fml::RefPtr<fml::TaskRunner> CreateNewThread(const std::string& name) {
|
||||
XCTAssertTrue([childClippingView pointInside:CGPointMake(199, 199) withEvent:nil]);
|
||||
}
|
||||
|
||||
- (void)testReleasesBackdropFilterSubviewsOnChildClippingViewDealloc {
|
||||
__weak NSMutableArray<UIVisualEffectView*>* weakBackdropFilterSubviews = nil;
|
||||
@autoreleasepool {
|
||||
ChildClippingView* clipping_view = [[ChildClippingView alloc] initWithFrame:CGRectZero];
|
||||
weakBackdropFilterSubviews = clipping_view.backdropFilterSubviews;
|
||||
XCTAssertNotNil(weakBackdropFilterSubviews);
|
||||
clipping_view = nil;
|
||||
}
|
||||
XCTAssertNil(weakBackdropFilterSubviews);
|
||||
}
|
||||
|
||||
- (void)testApplyBackdropFilter {
|
||||
flutter::FlutterPlatformViewsTestMockPlatformViewDelegate mock_delegate;
|
||||
auto thread_task_runner = CreateNewThread("FlutterPlatformViewsTest");
|
||||
|
||||
@@ -120,6 +120,8 @@
|
||||
// filters.
|
||||
- (void)applyBlurBackdropFilters:(NSArray<PlatformViewFilter*>*)filters;
|
||||
|
||||
// For testing only.
|
||||
- (NSMutableArray*)backdropFilterSubviews;
|
||||
@end
|
||||
|
||||
namespace flutter {
|
||||
|
||||
@@ -236,7 +236,7 @@ static BOOL _preparedOnce = NO;
|
||||
|
||||
- (NSMutableArray*)backdropFilterSubviews {
|
||||
if (!_backdropFilterSubviews) {
|
||||
_backdropFilterSubviews = [[[NSMutableArray alloc] init] retain];
|
||||
_backdropFilterSubviews = [[NSMutableArray alloc] init];
|
||||
}
|
||||
return _backdropFilterSubviews;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user