]> nmode's Git Repositories - signal-cli/commitdiff
Move saving out of synchronized block
authorAsamK <asamk@gmx.de>
Sun, 26 Dec 2021 11:40:06 +0000 (12:40 +0100)
committerAsamK <asamk@gmx.de>
Sun, 26 Dec 2021 11:40:06 +0000 (12:40 +0100)
lib/src/main/java/org/asamk/signal/manager/storage/groups/GroupStore.java

index f24ee99cf42f07b14053e0c9a983fac99099ef7c..49968b3ae13ce328b1e36511fd922854c6443385 100644 (file)
@@ -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) {