Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@cyanglaz
Copy link
Contributor

@cyanglaz cyanglaz commented Feb 9, 2021

The FlutterPlatformViewSemanticsContainer created a strong reference back to the SemanticsObject when constructing an NSArray in the accessibilityElements method. To avoid the retain cycle, simply replace the accessibilityElements with the AccessibilityContainer protocol methods.

Fixes flutter/flutter#73716

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.
  • The reviewer has submitted any presubmit flakes in this PR using the engine presubmit flakes form before re-triggering the failure.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Copy link
Contributor

@chunhtai chunhtai left a 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];
Copy link
Contributor

@chunhtai chunhtai Feb 9, 2021

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.

Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cyanglaz cyanglaz added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Feb 9, 2021
@fluttergithubbot fluttergithubbot merged commit 73b1d3f into flutter:master Feb 9, 2021
@cyanglaz cyanglaz deleted the platform_view_a11y_leak branch February 9, 2021 21:32
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 9, 2021
hjfreyer pushed a commit to hjfreyer/engine that referenced this pull request Mar 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes platform-ios waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS VoiceOver disrupts the lifecycle of platform views

3 participants