From: Damyan Ivanov Date: Sun, 28 Apr 2019 19:32:24 +0000 (+0300) Subject: LockHolder: reset lock instances to null after unlocking X-Git-Tag: v0.10.0~61 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=8d679bd0f916651309eada885bcff8970193909f;p=mobile-ledger.git LockHolder: reset lock instances to null after unlocking --- diff --git a/app/src/main/java/net/ktnx/mobileledger/utils/LockHolder.java b/app/src/main/java/net/ktnx/mobileledger/utils/LockHolder.java index 0f3fa388..5890f0a8 100644 --- a/app/src/main/java/net/ktnx/mobileledger/utils/LockHolder.java +++ b/app/src/main/java/net/ktnx/mobileledger/utils/LockHolder.java @@ -31,8 +31,8 @@ public class LockHolder implements AutoCloseable { } @Override public void close() { - if (wLock != null) wLock.unlock(); - if (rLock != null) rLock.unlock(); + if (wLock != null) { wLock.unlock(); wLock = null; } + if (rLock != null) { rLock.unlock(); rLock = null; } } public void downgrade() { if (rLock == null) throw new IllegalStateException("no locks are held");