[release/7.0.2xx] [net7.0] [core] WeakEventManager.RemoveEventHandler() should clear subscriptions#14074
Merged
rmarinho merged 3 commits intorelease/7.0.2xxfrom Mar 21, 2023
Conversation
Context: #12039 Context: https://github.com/Vroomer/MAUI-master-detail-memory-leak Context: https://github.com/symbiogenesis/Maui.DataGrid/tree/memory-leak Reviewing memory snapshots in the above apps, sometimes I would see new `WeakEventManager+Subscription` objects be created and never go away. I noticed the `WeakEventManager.RemoveEventHandler()` method did not remove any `Subscription` entries that it encountered were no longer alive. I could reproduce this problem in a test, and improved an existing test to check this collection is cleared appropriately: readonly Dictionary<string, List<Subscription>> _eventHandlers = new();
This is closer to the standard `forr` snippet that has been around forever, just using `n` instead of `i`.
Member
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
mandel-macaque
approved these changes
Mar 20, 2023
rmarinho
approved these changes
Mar 21, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #13650 to release/7.0.2xx
/cc @rmarinho @github-actions[bot]