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

Memory leak on TintedImageBehavior fix #1625

Merged
merged 5 commits into from
Feb 14, 2024
Merged

Memory leak on TintedImageBehavior fix #1625

merged 5 commits into from
Feb 14, 2024

Conversation

Marioo1357
Copy link
Contributor

@Marioo1357 Marioo1357 commented Dec 28, 2023

We subscribe to OnElementPropertyChanged only once - OnAttached - instead of each time the TintColor is changed

Every time when color was applied, the void was added to event handler. It causes that every next ImageSource change, invoked heavy color logic multiple times

Description of Change

Move dispose and subscibe logic right place in ImageTintBehavior

Linked Issues

PR Checklist

  • Has a linked Issue, and the Issue has been approved(bug) or Championed (feature/proposal)
  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pulls

Additional information

Every time when color was applied, the void was added to event handler.
It causes that every next ImageSource change, invoked heavy color logic multiple times
@Marioo1357
Copy link
Contributor Author

@dotnet-policy-service agree

Copy link
Collaborator

@VladislavAntonyuk VladislavAntonyuk left a comment

Choose a reason for hiding this comment

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

Thank you!
Just add some explanation: we subscribe to OnElementPropertyChanged only once - OnAttached - instead of each time the TintColor is changed

@Marioo1357 Marioo1357 closed this Dec 29, 2023
@Marioo1357 Marioo1357 reopened this Dec 29, 2023
@Marioo1357
Copy link
Contributor Author

PR has:

  • no test because the tests on native code are not supported
  • no any additional samples, because current is enough
  • no documentation updated, because there is no change in any behaviour

@bijington bijington enabled auto-merge (squash) February 13, 2024 19:47
@bijington bijington merged commit cc62c6f into CommunityToolkit:main Feb 14, 2024
7 checks passed
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.

[BUG] IconTintColorBehavior huge memory leak and app freeze on Android
5 participants