From 8d679bd0f916651309eada885bcff8970193909f Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sun, 28 Apr 2019 22:32:24 +0300 Subject: [PATCH] LockHolder: reset lock instances to null after unlocking --- app/src/main/java/net/ktnx/mobileledger/utils/LockHolder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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"); -- 2.39.5