High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix(mobile): make cancellation in image providers consistent (#31823)
Luis Nachtigall93f65b750e6e
diff --git a/mobile/lib/presentation/widgets/images/image_provider.dart b/mobile/lib/presentation/widgets/images/image_provider.dartindex bdedd29d45..19701d7c77 100644--- a/mobile/lib/presentation/widgets/images/image_provider.dart+++ b/mobile/lib/presentation/widgets/images/image_provider.dart@@ -98,6 +98,9 @@ mixin CancellableImageProviderMixin<T extends Object> on CancellableImageProvideisFinished = isFinal;return codec;} catch (e) {+ if (isCancelled) {+ return null;+ }if (isFinal) {isFinished = true;PaintingBinding.instance.imageCache.evict(this);@@ -111,16 +114,20 @@ mixin CancellableImageProviderMixin<T extends Object> on CancellableImageProvideStream<ImageInfo> initialImageStream() async* {final cachedOperation = this.cachedOperation;- if (cachedOperation == null) {+ if (isCancelled || cachedOperation == null) {return;}try {final cachedImage = await cachedOperation.valueOrCancellation();- if (cachedImage != null && !isCancelled) {- yield cachedImage;+ if (isCancelled || cachedImage == null) {+ return;}+ yield cachedImage;} catch (e, stack) {+ if (isCancelled) {+ return;+ }_log.severe('Error loading initial image', e, stack);} finally {this.cachedOperation = null;