Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Fix ConcurrentModificationError

laurenspriem55044b18186a
diff --git a/mobile/lib/services/machine_learning/face_ml/person/person_service.dart b/mobile/lib/services/machine_learning/face_ml/person/person_service.dart
index 8dff6c99a0..593a6628d1 100644
--- a/mobile/lib/services/machine_learning/face_ml/person/person_service.dart
+++ b/mobile/lib/services/machine_learning/face_ml/person/person_service.dart
@@ -343,13 +343,14 @@ class PersonService {
final clusterID = clusterIdToFaceIDs.key;
final faceIDs = clusterIdToFaceIDs.value;
final foundRejectedFacesToCluster = <String, String>{};
+ final removeFaceIDs = <String>{};
for (final faceID in faceIDs) {
if (assignedAndRejectedFaceIDs.contains(faceID)) {
- faceIDs.remove(faceID);
+ removeFaceIDs.add(faceID);
foundRejectedFacesToCluster[faceID] = clusterID;
}
}
- if (faceIDs.isEmpty) {
+ if (faceIDs.length == removeFaceIDs.length) {
logger.info(
"Cluster $clusterID for person ${e.id} ${personData.name} is empty due to rejected faces from remote, removing the cluster from person",
);