From 93291cb42e372e24a4202369c2f9f653a19d9f59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Tue, 13 May 2025 19:47:39 +0200 Subject: [PATCH] Fixed: #2455 Commandline export ConcurrentModificationException --- CHANGELOG.md | 2 ++ .../com/jpexs/helpers/CancellableWorker.java | 26 ++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fc816408..5006c286c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,6 +75,7 @@ All notable changes to this project will be documented in this file. - FLA export - Rounding errors on COLORMATRIXFILTER contrast - Filters - image bounds - Simple editor - Exceptions caused by not setting timelined when modifying PlaceObject +- [#2455] Commandline export ConcurrentModificationException ### Removed - Option to preview flash items via ActiveX component is no longer available. @@ -3795,6 +3796,7 @@ Major version of SWF to XML export changed to 2. [#2355]: https://www.free-decompiler.com/flash/issues/2355 [#2419]: https://www.free-decompiler.com/flash/issues/2419 [#2454]: https://www.free-decompiler.com/flash/issues/2454 +[#2455]: https://www.free-decompiler.com/flash/issues/2455 [#2375]: https://www.free-decompiler.com/flash/issues/2375 [#2374]: https://www.free-decompiler.com/flash/issues/2374 [#2389]: https://www.free-decompiler.com/flash/issues/2389 diff --git a/libsrc/ffdec_lib/src/com/jpexs/helpers/CancellableWorker.java b/libsrc/ffdec_lib/src/com/jpexs/helpers/CancellableWorker.java index ad7c4a6c5..3dcdf0d6e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/helpers/CancellableWorker.java +++ b/libsrc/ffdec_lib/src/com/jpexs/helpers/CancellableWorker.java @@ -155,7 +155,9 @@ public abstract class CancellableWorker implements RunnableFuture { @Override public final void run() { - workers.add(this); + synchronized (CancellableWorker.class) { + workers.add(this); + } future.run(); } @@ -245,7 +247,9 @@ public abstract class CancellableWorker implements RunnableFuture { if (thread != null && thread2Worker.get(thread) == this) { //thread2Worker.remove(thread); } - workers.remove(this); + synchronized (CancellableWorker.class) { + workers.remove(this); + } done(); } @@ -282,15 +286,17 @@ public abstract class CancellableWorker implements RunnableFuture { * Cancels all background threads. */ public static void cancelBackgroundThreads() { - List oldWorkers = workers; - workers = Collections.synchronizedList(new ArrayList()); - for (CancellableWorker worker : oldWorkers) { - if (worker != null) { - worker.cancel(true); - } else { - Logger.getLogger(CancellableWorker.class.getName()).log(Level.SEVERE, "worker is null"); + synchronized (CancellableWorker.class) { + List oldWorkers = workers; + workers = Collections.synchronizedList(new ArrayList()); + for (CancellableWorker worker : oldWorkers) { + if (worker != null) { + worker.cancel(true); + } else { + Logger.getLogger(CancellableWorker.class.getName()).log(Level.SEVERE, "worker is null"); + } } - } + } } public static void cancelThread(Thread t) {