From 8e7a5d0e13cb1fbbf3a2d71de99b119ef56a999c Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sat, 25 Apr 2020 21:02:36 +0200 Subject: [PATCH] deadlock-fix --- library/LocalLibrary.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/library/LocalLibrary.java b/library/LocalLibrary.java index 3cf5a25..aec8972 100644 --- a/library/LocalLibrary.java +++ b/library/LocalLibrary.java @@ -637,10 +637,13 @@ public class LocalLibrary extends BasicLibrary { } Map stories = this.stories; - synchronized (lock) { - if (stories == null) { - stories = getStoriesDo(pg); - this.stories = stories; + if (stories == null) { + stories = getStoriesDo(pg); + synchronized (lock) { + if (this.stories == null) + this.stories = stories; + else + stories = this.stories; } } -- 2.27.0