Skip to content

Commit 70224bc

Browse files
[Android] Fix: Prevent Duplicate MapSource Invocations on setting Image's Source to Local File Paths (#28405)
* add extra condition * use _sourceCancellation
1 parent f94b535 commit 70224bc

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Core/src/Handlers/Image/ImageHandler.Android.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ internal static void OnPlatformViewAttachedToWindow(IImageHandler imageHandler)
100100
// So we want to reload the image here if it's supposed to have an image
101101
if (imageHandler.SourceLoader.CheckForImageLoadedOnAttached &&
102102
imageHandler.PlatformView.Drawable is null &&
103-
imageHandler.VirtualView.Source is not null)
103+
imageHandler.VirtualView.Source is not null && !imageHandler.SourceLoader.SourceManager.IsLoading)
104104
{
105105
imageHandler.SourceLoader.CheckForImageLoadedOnAttached = false;
106106
imageHandler.UpdateValue(nameof(IImage.Source));

src/Core/src/ImageSources/ImageSourceServiceResultManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ internal class ImageSourceServiceResultManager
2626
CancellationTokenSource? _sourceCancellation;
2727
IDisposable? _sourceResult;
2828

29+
public bool IsLoading => _sourceCancellation is not null;
2930
public CancellationToken Token =>
3031
_sourceCancellation?.Token ?? default;
3132

0 commit comments

Comments
 (0)