-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS] RemoveObserver only if previously was added #14790
Conversation
… with custom renderer.
Do we have an ETA of this being merged? |
@jsuarezruiz @jfversluis Tested against PR build 5.0.0.7769 and bug is still reproducible. Stack trace:
|
@tylerjnettleton would you be able to test #14828 ? I see this tries to do the same thing. Didn't notice this one 😅 |
Is this change correct? This bit from the PR description doesn't make sense to me
I have a custom Entry renderer in my app that's seeing the same issue and the very first line in that override is calling base.OnElementChanged which is where the observer is being added. |
@lee-m to avoid any confusion here. I think this PR and the one you tested try and fix the same thing. I simply did not see this one while I created the other one. If mine works good in all scenarios I will merge my PR and this one will be abandoned. If I understand you correctly, my change also works well for you when you are using a custom renderer? |
@jfversluis Yes your changes work when simply swapping out the NuGet packages for the preview ones with your fix in. I've spent several days trying to find the root cause and seeing reference to a custom renderer got me thinking if that was it, but then realised the reasoning given behind why that caused it (AddObserver not called) couldn't be true for my case so had me questioning whether the changes in this PR are really fixing anything. |
Seeing the response from @tylerjnettleton it doesn't seem to fix it, just waiting for them to confirm so we can move forward on the other fix. |
Co-Authored-By: Javier Suárez <javiersuarezruiz@hotmail.com>
Description of Change
Avoid possible exception with custom Entry renderer. If create a Custom Renderer will not register the sublayers observer but will try to remove it disposing the renderer. This PR include changes to avoid remove the observer if previously was not added.
Fixes
Cannot remove an observer X for the key path "Y" from Z because it is not registered as an observer.
Issues Resolved
API Changes
None
Platforms Affected
Behavioral/Visual Changes
None
Before/After Screenshots
Not applicable
PR Checklist