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

Fixes a memory leak in Android's CollectionViewRenderer #111

Merged
merged 1 commit into from
Jan 15, 2024

Conversation

AdamEssenmacher
Copy link
Contributor

@AdamEssenmacher AdamEssenmacher commented Jan 14, 2024

Fixes #110

We need to be careful using the ViewTreeObserver getter. It can return different instances depending on where the view is in its lifecycle, resulting in events being unsubscribed from instances they were not subscribed to.

This PR converts the event subscription to using an explicit handler, which allows us to subscribe to the event using a weak reference back to the renderer and thus avoiding the memory leak.

@roubachof
Copy link
Owner

That's some quality PR here, thanks !

@roubachof roubachof closed this Jan 15, 2024
@roubachof roubachof reopened this Jan 15, 2024
@roubachof roubachof merged commit b2dc61d into roubachof:main Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Memory leak in Android CollectionView
2 participants