Fixes Semantic Object memory leak cause of wrong release call (flutter/engine#18107)

This commit is contained in:
Wu Zhong 2020-05-21 02:35:37 +08:00 committed by GitHub
parent 955906137a
commit 29fe2d75a5

View File

@ -179,11 +179,10 @@ static SemanticsObject* CreateObject(const flutter::SemanticsNode& node,
return [[[TextInputSemanticsObject alloc] initWithBridge:weak_ptr uid:node.id] autorelease];
} else if (node.HasFlag(flutter::SemanticsFlags::kHasToggledState) ||
node.HasFlag(flutter::SemanticsFlags::kHasCheckedState)) {
SemanticsObject* delegateObject = [[FlutterSemanticsObject alloc] initWithBridge:weak_ptr
uid:node.id];
SemanticsObject* delegateObject =
[[[FlutterSemanticsObject alloc] initWithBridge:weak_ptr uid:node.id] autorelease];
return (SemanticsObject*)[[[FlutterSwitchSemanticsObject alloc]
initWithSemanticsObject:delegateObject] autorelease];
[delegateObject release];
} else {
return [[[FlutterSemanticsObject alloc] initWithBridge:weak_ptr uid:node.id] autorelease];
}