-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Fabric] Fix image component reference cycle #13440
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
Conversation
| if (auto imgComponentView{m_wkImage.get()}) { | ||
| auto imageResponseImage = std::static_pointer_cast<ImageResponseImage>(imageResponse.getImage()); | ||
| imgComponentView->m_reactContext.UIDispatcher().Post( | ||
| [imageResponseImage, imgComponentView]() { imgComponentView->didReceiveImage(imageResponseImage); }); |
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.
This capture of [imgeComponentView] doesn't seem to be matched by taking a ref. Isn't it possible that ref could be gone by the time Post gets processed?
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.
imgeComponentView is a winrt runtimeclass, so it takes a ref. Having said that, this should probably capture the weak ref and re-resolve it to avoid keeping the component alive.
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.
So much fun to check a weak ref before deciding to pass on another weak ref, to then check that again.
* [Fabric] Fix image component reference cycle * Change files * format * disable aggressive component deleted assert * Use weak_ref for image didReceiveImage callback * typo * Unsubscribe from imageresponseobserver when deleted - aligns with core * format
* [Fabric] Move to WinAppSDK types for KeyStatus, and ensure usages account for locked flag (#13435) * [Fabric] Move to WinAppSDK types for KeyStatus, and ensure usages account for locked flag * Change files * Use scrollEnabled flag to enable/disable the ScrollView (#13427) * Fix scrollview * Change files * Address feedback * Return false for scroll event handlers when scroll is disabled * Update scrollbar color based on scrollEnabled * Rename OnThemeChanged to UpdateColorForScrollBarRegions * [Fabric] Fix image component reference cycle (#13440) * [Fabric] Fix image component reference cycle * Change files * format * disable aggressive component deleted assert * Use weak_ref for image didReceiveImage callback * typo * Unsubscribe from imageresponseobserver when deleted - aligns with core * format * [Fabric] call reportMount to implement UIManagerMountHook support (#13443) * [Fabric] call reportMount to implement UIManagerMountHook support * Change files * Resolve Transform Matrix before Animation (#13450) * Resolve transform before animation * Change files * Minor naming fix * noexcept * [Fabric] Text renders borders twice (#13445) * [Fabric] Text renders borders twice * Change files * Add fabric test for text borders * snapshot updates * snapshots * fix change file types --------- Co-authored-by: Sharath Manchala <10109130+sharath2727@users.noreply.github.com>
* [Fabric] Fix image component reference cycle * Change files * format * disable aggressive component deleted assert * Use weak_ref for image didReceiveImage callback * typo * Unsubscribe from imageresponseobserver when deleted - aligns with core * format
* [Fabric] Patch yoga to include changes to correctly recalculate layout on scale change (#13407) * Patch yoga to handle dynamic scale changes * Change files * Update vnext/overrides.json Co-authored-by: Marlene Cota <1422161+marlenecota@users.noreply.github.com> * Update vnext/overrides.json Co-authored-by: Marlene Cota <1422161+marlenecota@users.noreply.github.com> * Update vnext/overrides.json Co-authored-by: Marlene Cota <1422161+marlenecota@users.noreply.github.com> * Update vnext/overrides.json Co-authored-by: Marlene Cota <1422161+marlenecota@users.noreply.github.com> * Update vnext/overrides.json Co-authored-by: Marlene Cota <1422161+marlenecota@users.noreply.github.com> * Update vnext/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/config/Config.cpp Co-authored-by: Marlene Cota <1422161+marlenecota@users.noreply.github.com> * Update vnext/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/config/Config.h Co-authored-by: Marlene Cota <1422161+marlenecota@users.noreply.github.com> * Update vnext/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/config/Config.h Co-authored-by: Marlene Cota <1422161+marlenecota@users.noreply.github.com> * Update vnext/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/LayoutResults.cpp Co-authored-by: Marlene Cota <1422161+marlenecota@users.noreply.github.com> * Update vnext/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/LayoutResults.h Co-authored-by: Marlene Cota <1422161+marlenecota@users.noreply.github.com> * review feedback from yoga PR --------- Co-authored-by: Marlene Cota <1422161+marlenecota@users.noreply.github.com> * [Fabric] Handle scale factor changes (#13406) * [Fabric] Handle scalefactor changes * Change files * [Fabric] Handle changes to BorderRadius (#13422) * Handle changes to borderradius * Change files * format * [Fabric] [Win32] Add image response APIs to win32 exports (#13428) * Add image response APIs to win32 exports * Change files * fix * [Fabric] Move to WinAppSDK types for KeyStatus, and ensure usages account for locked flag (#13435) * [Fabric] Move to WinAppSDK types for KeyStatus, and ensure usages account for locked flag * Change files * Use scrollEnabled flag to enable/disable the ScrollView (#13427) * Fix scrollview * Change files * Address feedback * Return false for scroll event handlers when scroll is disabled * Update scrollbar color based on scrollEnabled * Rename OnThemeChanged to UpdateColorForScrollBarRegions * [Fabric] Fix image component reference cycle (#13440) * [Fabric] Fix image component reference cycle * Change files * format * disable aggressive component deleted assert * Use weak_ref for image didReceiveImage callback * typo * Unsubscribe from imageresponseobserver when deleted - aligns with core * format * [Fabric] call reportMount to implement UIManagerMountHook support (#13443) * [Fabric] call reportMount to implement UIManagerMountHook support * Change files * Resolve Transform Matrix before Animation (#13450) * Resolve transform before animation * Change files * Minor naming fix * noexcept * [Fabric] Text renders borders twice (#13445) * [Fabric] Text renders borders twice * Change files * Add fabric test for text borders * snapshot updates * snapshots * align overrides for 0.75 branch * snapshot --------- Co-authored-by: Marlene Cota <1422161+marlenecota@users.noreply.github.com> Co-authored-by: Sharath Manchala <10109130+sharath2727@users.noreply.github.com>
Description
ImageComponentView's currently have a reference cycle with theWindowsImageResponseObserverwhich caused leaks of everyImageComponentView.This makes the
WindowsImageResponseObserverhave a weak ref to resolve the cycle.Added some debug code to detect leaks of ComponentView's. This debug code maybe to too aggressive - we'll see.
-- left the leak detection code #ifdef'd out for now.
Microsoft Reviewers: Open in CodeFlow