From 98ad33a5892dde5579f79b92da20bfcbebebbb98 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Tue, 15 Sep 2020 21:59:16 +0200 Subject: [PATCH] Fix concurrent modification --- .../main/java/com/kunzisoft/keepass/database/element/Entry.kt | 3 +-- .../com/kunzisoft/keepass/database/element/entry/EntryKDBX.kt | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/Entry.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/Entry.kt index 9f1e4b2b1..a63816d94 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/Entry.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/Entry.kt @@ -450,6 +450,7 @@ class Entry : Node, EntryVersionedInterface { database?.startManageEntry(this) removeAllFields() + removeAllAttachments() // NodeId stay as is title = newEntryInfo.title icon = newEntryInfo.icon @@ -461,8 +462,6 @@ class Entry : Node, EntryVersionedInterface { notes = newEntryInfo.notes addExtraFields(newEntryInfo.customFields) database?.binaryPool?.let { binaryPool -> - // TODO Concurrent modification - // removeAllAttachments() addAttachments(binaryPool, newEntryInfo.attachments) } diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryKDBX.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryKDBX.kt index 17a08f823..fab8e0a9c 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryKDBX.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/entry/EntryKDBX.kt @@ -310,9 +310,7 @@ class EntryKDBX : EntryVersioned, NodeKDBXInte } fun removeAttachments() { - binaries.keys.forEach { - binaries.remove(it) - } + binaries.clear() } private fun getAttachmentsSize(binaryPool: BinaryPool): Long {