-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Animatable: fix transitions memory leak #12861
Animatable: fix transitions memory leak #12861
Conversation
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.
@kekekeks can you help me on this if im speaking out of turn or making wrong assumptions, i just making a very general suggestion and someone with a lot of history has to be a sort of code police and nnone wants to be that "fault finder".. but its for everyones benefit.
TDLR my suggestion are at the bottom : its jsut i've owned wpf code and its get to where sometime you want to rewrite it so unmanagleble and delicate .. .im there now.with my own wpf IDE project. and thats why im looking at avalonia again.
im new here but was in industry 15 years in Silicon valley and game tooling and we had alot of UI.. and otehr compandies including my own., with wpf tooling.. owning code just get more expensive as it grows .. i am seeing signs of code churn and too mjch state management.. ive watched in for 10 years its getting very amazing but.. its got 3 ways to do ui and 7 platorms thats amazing but.. its scary.
one thing i llook for is symmetry.. and redunancy.
noone wants to break anything so they tend to add fixes and state to represent the conditions under which the bug happens.. or leave existing state there when it should not be needed. but that adds exponential complexity. they dont wanna destroy anyones work .
the "dependency property "was added to UIElement when its not real data. so whenever possilbe shouid be used. (Please verify i dont know react)
also overdetermination.. means too many variables that can be a function or a query or a combination of another essential one(s) state , meaning its redundant . the best fix removes code especially state that represents a visualization.. thie wpf paradigm means bind to actual ( persistent) data members via properties, the lifetime of the data either as a setting or in a file.** .
its means careful review and wide understanding, but not in every case.. anyone can try to change a base class. if that class has an antipattern related to the bug(s) they wann fix. jsut test all the samples.. sometiems breaking fxing a thing , breaking 5 other things, is ok if you can fix all that by simplification unless you are close to a release or on a master branch. like this is..
_transitionsEnabled ? its his real data? is it needed? it it a dependency property.. is there another way to query it..
_isSubscribedToTransitionsCollection
newTransitions.CollectionChanged += TransitionsCollectionChangedHandler;
_isSubscribedToTransitionsCollection = true;
can you just do newTransitions.CollectionChanged -= TransitionsCollectionChangedHandler; somehwere.. its not going to do anything if not subcribed to is own handler.. then remove _isSubscribedToTransitionsCollection my staff idd that to fix leaks an i never have a problem.. if you unlisten twice its not a big deal... its not null.. however. on a massive grid it could be slow... i am not sure.. i
also i dont know OSS etiquette tell me when or where to be quiet .. im not invested in this yet.
@damian-666 we are totally aware of the need to refractor some areas. If you have followed the development of v11 vs 0.10.x, you probably have seen the many breaking changes we introduced. One of the motivation doing that was to get a more stable API while still allowing us to do needed refracturing later on. Still there are some area for improvement, so your contribution is welcome. |
Thanks, I looked over the code in the base class and its seems like it's ok. i'll be aware that you already bit the bullet v10 to v11. and il plan to build from the develop branch as things stabilize, and i probably will be on net8 or 9 by the time i really transtiion to this.. i watched on and off it since 2017 some old apis can be marked [deprecated] or hide it to completion .. spit a warning it they still use it.. that can save alot of suffering on clients.. thta use closed parts and cant update binaries.. the two ways according to SE are puting -= then += to avoid double notification. or uisng the adding of the extra state as it was done here i like the business model, of this project, so i wont get burned by closed sources again.. rahter pay for consulting..to gurus |
91f7198
to
53e40e8
Compare
You can test this PR using the following package version. |
53e40e8
to
b5fa6fb
Compare
You can test this PR using the following package version. |
…lready enabled. (#12861) Co-authored-by: Dmitry Zhelnin <[email protected]>
What does the pull request do?
Fixes memory leak in
Animatable
.What is the current behavior?
Sometimes subscriptions to
Transitions
collection changes are leaked.What is the updated/expected behavior with this PR?
Leaks are fixed.
How was the solution implemented (if it's not obvious)?
Subscription is made only if control is already attached to visual tree.
Fixed issues
Fixes #12860