From 3b81ba3596a9965118034c0e6d767b2f2f4d60c7 Mon Sep 17 00:00:00 2001 From: AsamK Date: Sun, 26 Dec 2021 12:40:06 +0100 Subject: [PATCH] Move saving out of synchronized block --- .../org/asamk/signal/manager/storage/groups/GroupStore.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/src/main/java/org/asamk/signal/manager/storage/groups/GroupStore.java b/lib/src/main/java/org/asamk/signal/manager/storage/groups/GroupStore.java index f24ee99c..49968b3a 100644 --- a/lib/src/main/java/org/asamk/signal/manager/storage/groups/GroupStore.java +++ b/lib/src/main/java/org/asamk/signal/manager/storage/groups/GroupStore.java @@ -189,6 +189,7 @@ public class GroupStore { } public void mergeRecipients(final RecipientId recipientId, final RecipientId toBeMergedRecipientId) { + Storage storage = null; synchronized (groups) { var modified = false; for (var group : this.groups.values()) { @@ -201,9 +202,12 @@ public class GroupStore { } } if (modified) { - saver.save(toStorageLocked()); + storage = toStorageLocked(); } } + if (storage != null) { + saver.save(storage); + } } private GroupInfo getGroupLocked(final GroupId groupId) {