-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
LayoutTransformControl - fix memory leak due to Transform.Changed event subscription #19718
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
base: master
Are you sure you want to change the base?
LayoutTransformControl - fix memory leak due to Transform.Changed event subscription #19718
Conversation
You can test this PR using the following package version. |
You can test this PR using the following package version. |
You can test this PR using the following package version. |
8e532de
to
2399ffc
Compare
94f2564
to
469724e
Compare
You can test this PR using the following package version. |
b65ef96
to
fe02b0b
Compare
You can test this PR using the following package version. |
@MrJul Please let me know if anything needs to be reworked |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! While this PR does fix the leak, it depends on WeakEventManager
. That class is using reflection, which we try to avoid.
I think a better solution would be to unsubscribe from the event in OnDetachedFromVisualTree
and subscribe to in again in OnAttachedToVisualTree
. (Also avoid subscribing at all in LayoutTransformedChanged if the control isn't currently attached to the visual tree).
ОК, will do |
What does the pull request do?
The subscription to the Transform.Changed event was changed from Observable.FromEventPattern to WeakEventHandlerManager.Subscribe (see #19698)
What is the current behavior?
Memory leak observed after LayoutTransformControl is remove from the visual tree.
What is the updated/expected behavior with this PR?
Memory doesn`t leak, LayoutTransformControl is correctly collected
Fixed issues
#19698