From 303498804e6a20719d2ce51d50405ea9699dad3e Mon Sep 17 00:00:00 2001 From: "honfika@gmail.com" Date: Sun, 18 Jan 2015 19:27:11 +0100 Subject: [PATCH] synchronize getCharacters, getJtt && getAbcList --- .../src/com/jpexs/decompiler/flash/SWF.java | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index 7008c8fd3..9020241da 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -307,9 +307,13 @@ public final class SWF implements SWFContainerItem, Timelined { public Map getCharacters() { if (characters == null) { - Map chars = new HashMap<>(); - parseCharacters(tags, chars); - characters = chars; + synchronized (this) { + if (characters == null) { + Map chars = new HashMap<>(); + parseCharacters(tags, chars); + characters = chars; + } + } } return characters; @@ -321,9 +325,13 @@ public final class SWF implements SWFContainerItem, Timelined { public List getAbcList() { if (abcList == null) { - ArrayList newAbcList = new ArrayList<>(); - getAbcTags(tags, newAbcList); - abcList = newAbcList; + synchronized (this) { + if (abcList == null) { + ArrayList newAbcList = new ArrayList<>(); + getAbcTags(tags, newAbcList); + abcList = newAbcList; + } + } } return abcList; @@ -357,10 +365,14 @@ public final class SWF implements SWFContainerItem, Timelined { public synchronized JPEGTablesTag getJtt() { if (jtt == null) { - for (Tag t : tags) { - if (t instanceof JPEGTablesTag) { - jtt = (JPEGTablesTag) t; - break; + synchronized (this) { + if (jtt == null) { + for (Tag t : tags) { + if (t instanceof JPEGTablesTag) { + jtt = (JPEGTablesTag) t; + break; + } + } } } }