Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disconnect the channel message handler when releasing the AccessibilityBridge #18657

Merged
merged 1 commit into from
May 29, 2020

Conversation

jason-simmons
Copy link
Member

@xster
Copy link
Member

xster commented May 29, 2020

Doh, it's the same as #17646. Thanks for fixing. Can we add a similar test?

@jason-simmons
Copy link
Member Author

Added a test

AccessibilityChannel channel = mock(AccessibilityChannel.class);
AccessibilityBridge accessibilityBridge =
setUpBridge(null, channel, null, null, null, null);
verify(channel).setAccessibilityMessageHandler(null);
Copy link
Member

Choose a reason for hiding this comment

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

since this is already null, I'd perhaps make this a bit more real by also injecting an AccessibilityManager and let it be isEnabled() true either via mockito or shadowOf(accessibilityManager).setEnabled(true)

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Copy link
Member

@xster xster left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the test

AccessibilityManager mockManager = mock(AccessibilityManager.class);
when(mockManager.isEnabled()).thenReturn(true);
AccessibilityBridge accessibilityBridge =
setUpBridge(null, mockChannel, mockManager, null, null, null);
Copy link
Member

Choose a reason for hiding this comment

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

I meant if you let it be isEnabled, then you can assert that the message handler is non-null before you release, at which point it's then null

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a check for the non-null setAccessibilityMessageHandler call done during AccessibilityBridge setup before release is called

Copy link
Member

Choose a reason for hiding this comment

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

👌 thanks!

AccessibilityManager mockManager = mock(AccessibilityManager.class);
when(mockManager.isEnabled()).thenReturn(true);
AccessibilityBridge accessibilityBridge =
setUpBridge(null, mockChannel, mockManager, null, null, null);
Copy link
Member

Choose a reason for hiding this comment

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

👌 thanks!

@jason-simmons jason-simmons 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 May 29, 2020
@fluttergithubbot fluttergithubbot merged commit 042804b into flutter:master May 29, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes 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.

Memory leak while cache FlutterEngine
4 participants