-
Notifications
You must be signed in to change notification settings - Fork 6k
Fix FlutterPlatformViewSemanticsContainer retain cycle with SemanticsObject #24308
Fix FlutterPlatformViewSemanticsContainer retain cycle with SemanticsObject #24308
Conversation
chunhtai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice detective work. I left a comment on the life cycle management, the overall approach looks good
| } | ||
|
|
||
| - (void)dealloc { | ||
| [_semanticsObject release]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the FlutterPlatformViewSemanticsContainer does not own the semantics object, it should not release it? also the property is declared as assign, it should not increase the reference count.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @gaaclarke who is more familiar with reference counting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops good catch! This code was there for debugging and I forgot to remove it. Removed now
chunhtai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The
FlutterPlatformViewSemanticsContainercreated a strong reference back to theSemanticsObjectwhen constructing an NSArray in theaccessibilityElementsmethod. To avoid the retain cycle, simply replace theaccessibilityElementswith theAccessibilityContainerprotocol methods.Fixes flutter/flutter#73716
Pre-launch Checklist
writing and running engine tests.
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.