Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Avoid retrying of local thumbnail fetch if ThumbnailWidget is not mounted

ashilkn1b45dfee0e22
diff --git a/mobile/lib/ui/viewer/file/thumbnail_widget.dart b/mobile/lib/ui/viewer/file/thumbnail_widget.dart
index e5f74d0d59..298b7e1d6a 100644
--- a/mobile/lib/ui/viewer/file/thumbnail_widget.dart
+++ b/mobile/lib/ui/viewer/file/thumbnail_widget.dart
@@ -314,7 +314,7 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
int retryAttempts = 0;
while (retryAttempts <= _maxLocalThumbnailRetries) {
try {
- return _getLocalThumbnailUsingHeapPriorityQueue();
+ return await _getLocalThumbnailUsingHeapPriorityQueue();
} catch (e) {
// only retry for specific exceptions
if (e is! TaskQueueTimeoutException &&
@@ -322,6 +322,10 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
e is! TaskQueueCancelledException) {
rethrow;
}
+ //Do not retry if the widget is not mounted
+ if (!mounted) {
+ return null;
+ }
retryAttempts++;
final backoff = Duration(
@@ -329,7 +333,7 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
);
if (retryAttempts <= _maxLocalThumbnailRetries) {
_logger.warning(
- "Error getting local thumbnail for ${widget.file.displayName}, retrying (attempt $retryAttempts) in $backoff ms",
+ "Error getting local thumbnail for ${widget.file.displayName}, retrying (attempt $retryAttempts) in ${backoff.inMilliseconds} ms",
e,
);
await Future.delayed(backoff); // Exponential backoff
diff --git a/mobile/pubspec.lock b/mobile/pubspec.lock
index 4a250806c1..27457b51b2 100644
--- a/mobile/pubspec.lock
+++ b/mobile/pubspec.lock
@@ -981,6 +981,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.4.4"
+ flutter_password_strength:
+ dependency: "direct main"
+ description:
+ name: flutter_password_strength
+ sha256: "271b32c4003d7227e5a71d0303af0144e91a104b522da1a8d092b7847ebfee12"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.1.6"
flutter_plugin_android_lifecycle:
dependency: transitive
description: