Fix Button Regression with null image source#25485
Merged
PureWeen merged 5 commits intoOct 25, 2024
Merged
Conversation
jsuarezruiz
suggested changes
Oct 24, 2024
| #if IOS | ||
| ((Action)(async () => | ||
| { | ||
| var imageSource = new FileImageSource() { File = "shopping_cart.png" }; |
Contributor
There was a problem hiding this comment.
Could the test be extended to:
- Set the image when the button is tapped.
- Remove the image, setting a null value when tapping again.
- Reset the image by tapping the button again (for example, using a counter, odd sets image, even removes it).
?
e8b6993 to
7807d75
Compare
7807d75 to
cc5dc08
Compare
Member
Author
|
Okay, test has been rebased off the release/9.0.1xx branch, and it now uses the UIImage as a weakreference instead of the hash. Tests have also been updated on @jsuarezruiz's request! |
Member
Author
|
/azp run |
|
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
PureWeen
reviewed
Oct 24, 2024
| } | ||
| platformButton.UpdateContentEdgeInsets(button, contentEdgeInsets); | ||
|
|
||
| _originalImageRef.TryGetTarget(out var _originalImage); |
PureWeen
requested changes
Oct 24, 2024
PureWeen
approved these changes
Oct 25, 2024
jsuarezruiz
approved these changes
Oct 25, 2024
Member
|
/backport to release/8.0.1xx-sr10 |
Contributor
|
Started backporting to release/8.0.1xx-sr10: https://github.com/dotnet/maui/actions/runs/11518924955 |
rmarinho
pushed a commit
that referenced
this pull request
Oct 25, 2024
Member
|
/backport to 8.0.1xx-sr9 |
Contributor
|
Started backporting to 8.0.1xx-sr9: https://github.com/dotnet/maui/actions/runs/11595720335 |
Contributor
|
@PureWeen an error occurred while backporting to 8.0.1xx-sr9, please check the run log for details! The process '/usr/bin/git' failed with exit code 1 |
PureWeen
pushed a commit
that referenced
this pull request
Oct 30, 2024
PureWeen
added a commit
that referenced
this pull request
Oct 30, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes an null reference issue that occurs when an button has its image set by UIButton.SetImage. Instead of using the Button.ImageSource.ToString() to see if the image has changed without needing to hold a reference to the image, the code now uses the UIButton.CurrentImage hash to determine if the image has changed. This helps us know if the image was changed in those situations where the Button.ImageSource is null but the UIButton.CurrentImage is still set.
Description of Change
Issues Fixed
Fixes #25409