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

[release/7.0.2xx] [net7.0] [core] WeakEventManager.RemoveEventHandler() should clear subscriptions #14074

Merged
merged 3 commits into from
Mar 21, 2023

Conversation

github-actions[bot]
Copy link
Contributor

Backport of #13650 to release/7.0.2xx

/cc @rmarinho @github-actions[bot]

jonathanpeppers and others added 3 commits March 20, 2023 14:26
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`.
@rmarinho
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@rmarinho rmarinho merged commit 6e0d081 into release/7.0.2xx Mar 21, 2023
@rmarinho rmarinho deleted the backport/pr-13650-to-release/7.0.2xx branch March 21, 2023 10:52
@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2023
@samhouts samhouts added the fixed-in-7.0.81 Look for this fix in 7.0.81! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed-in-7.0.81 Look for this fix in 7.0.81! t/housekeeping ♻︎
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants