From fdcbe59cecca17c0218bd5229bb6cf3bd43ca893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Fri, 18 Nov 2022 21:48:32 +0100 Subject: [PATCH] Fixed ConcurrentModificationException in getCharacters on exit --- CHANGELOG.md | 1 + libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab88a18c6..09a71b9c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ All notable changes to this project will be documented in this file. - [#1877] Recalculate dependent characters and frames on removing / editing item - DefineShape4 SVG import NullPointerException - List of objects under cursor and coordinates not showing +- ConcurrentModificationException in getCharacters on exit ### Changed - GFX - DefineExternalImage2 no longer handled as character 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 5c3389b3d..6b3512e3a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -368,6 +368,9 @@ public final class SWF implements SWFContainerItem, Timelined { @Internal private Map asmsCache; + @Internal + private boolean destroyed = false; + private Set cyclicCharacters = null; private boolean headerModified = false; @@ -415,6 +418,7 @@ public final class SWF implements SWFContainerItem, Timelined { } public void clearTagSwfs() { + destroyed = true; decompilerPool.destroySwf(this); resetTimelines(this); updateCharacters(); @@ -485,10 +489,13 @@ public final class SWF implements SWFContainerItem, Timelined { di.getChildInfos().clear(); } - public Map getCharacters() { + public Map getCharacters() { if (characters == null) { synchronized (this) { if (characters == null) { + if (destroyed) { + return new HashMap<>(); + } Map chars = new HashMap<>(); Map> charIdtags = new HashMap<>(); Map eimages = new HashMap<>();