From: Niki Roo Date: Sat, 25 Apr 2020 19:02:36 +0000 (+0200) Subject: deadlock-fix X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=8e7a5d0e13cb1fbbf3a2d71de99b119ef56a999c;p=fanfix-jexer.git deadlock-fix --- 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; } }