From 03ddda8e19a0a1bbb8cb57b3b45ef08385869155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Fri, 18 Nov 2022 18:42:37 +0100 Subject: [PATCH] Fixed #1877 Recalculate dependent characters and frames on removing / editing item --- CHANGELOG.md | 2 ++ .../src/com/jpexs/decompiler/flash/SWF.java | 3 ++- .../decompiler/flash/gui/GenericTagTreePanel.java | 2 ++ .../flash/gui/tagtree/TagTreeContextMenu.java | 12 +++++++++++- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 803f7eb23..d52fb7810 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ All notable changes to this project will be documented in this file. - [#1840] AS3 - Allow to compile object literal keys with nonstring/numbers in obfuscated code - [#1840] AS3 Direct editation - Type mismatched for a trait - [#1840] Proper if..continue..break handling +- [#1877] Recalculate dependent characters and frames on removing / editing item ### Changed - GFX - DefineExternalImage2 no longer handled as character @@ -2616,6 +2617,7 @@ All notable changes to this project will be documented in this file. [#1757]: https://www.free-decompiler.com/flash/issues/1757 [#1807]: https://www.free-decompiler.com/flash/issues/1807 [#1840]: https://www.free-decompiler.com/flash/issues/1840 +[#1877]: https://www.free-decompiler.com/flash/issues/1877 [#1867]: https://www.free-decompiler.com/flash/issues/1867 [#1868]: https://www.free-decompiler.com/flash/issues/1868 [#1649]: https://www.free-decompiler.com/flash/issues/1649 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 a094962e7..5c3389b3d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -2838,12 +2838,13 @@ public final class SWF implements SWFContainerItem, Timelined { externalImages2 = null; timeline = null; cyclicCharacters = null; + dependentCharacters = null; + dependentFrames = null; clearReadOnlyListCache(); clearImageCache(); clearShapeCache(); clearScriptCache(); clearAbcListCache(); - clearAllStaticCache(); } public static void uncache(ASMSource src) { diff --git a/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java b/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java index 29bc69d6d..203062964 100644 --- a/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java +++ b/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java @@ -1172,6 +1172,8 @@ public class GenericTagTreePanel extends GenericTagPanel { ((Timelined)parentCharacter).resetTimeline(); } } + swf.computeDependentCharacters(); + swf.computeDependentFrames(); return true; } diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java index 165bf8e58..e5412f060 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java @@ -1393,6 +1393,10 @@ public class TagTreeContextMenu extends JPopupMenu { targetSwf.updateCharacters(); sourceSwf.resetTimelines(sourceSwf); targetSwf.resetTimelines(targetSwf); + sourceSwf.computeDependentCharacters(); + targetSwf.computeDependentCharacters(); + sourceSwf.computeDependentFrames(); + targetSwf.computeDependentFrames(); timelined.setFrameCount(timelined.getTimeline().getFrameCount()); @@ -2321,9 +2325,11 @@ public class TagTreeContextMenu extends JPopupMenu { tagsToRemoveBySwf.get(swf).add(tag); } - + for (SWF swf : tagsToRemoveBySwf.keySet()) { swf.removeTags(tagsToRemoveBySwf.get(swf), removeDependencies); + swf.computeDependentCharacters(); + swf.computeDependentFrames(); } for (SWF swf : swfsToClearCache) { @@ -2935,6 +2941,8 @@ public class TagTreeContextMenu extends JPopupMenu { sourceSwf.clearImageCache(); sourceSwf.clearShapeCache(); sourceSwf.updateCharacters(); + sourceSwf.computeDependentCharacters(); + sourceSwf.computeDependentFrames(); sourceSwf.resetTimelines(sourceSwf); } } @@ -2943,6 +2951,8 @@ public class TagTreeContextMenu extends JPopupMenu { targetSwf.clearImageCache(); targetSwf.clearShapeCache(); targetSwf.updateCharacters(); + targetSwf.computeDependentCharacters(); + targetSwf.computeDependentFrames(); targetSwf.resetTimelines(targetSwf); mainPanel.refreshTree(targetSwf);