From e971f6b928d5f8f839503929052676ca88d4b60a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Wed, 4 Oct 2023 10:06:30 +0200 Subject: [PATCH] Fixed Close action on SWF inside DefineBinaryData --- CHANGELOG.md | 3 +++ src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java | 11 +++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38de57b97..f61f51fd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ All notable changes to this project will be documented in this file. - [#2090] Support for Mochicrypt packed binarydata tags - loading SWF as subtree - [#2079] Replace DefineSprite with GIF, Bulk import sprites from GIFs, also from commandline +### Fixed +- Close action on SWF inside DefineBinaryData + ## [19.0.0] - 2023-10-01 ### Added - [#1449] Updated Turkish translation diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java index c24e3c188..f518e745a 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java @@ -259,13 +259,14 @@ public abstract class MainFrameMenu implements MenuBuilder { } } - private void enumerateListsToClose(Set listsToClose, Openable openable) { + private void enumerateListsToClose(Set listsToClose, Openable openable, List binaryDataClosedSwfs) { if (openable instanceof SWF) { SWF swf = (SWF) openable; if (swf.binaryData != null) { // embedded swf swf.binaryData.innerSwf = null; swf.clearTagSwfs(); + binaryDataClosedSwfs.add(swf); } else { listsToClose.add(swf.openableList); } @@ -282,16 +283,18 @@ public abstract class MainFrameMenu implements MenuBuilder { return; } Set listsToClose = new LinkedHashSet<>(); + List binaryDataClosedSwfs = new ArrayList<>(); + for (TreeItem item : mainFrame.getPanel().getCurrentTree().getSelected()) { if (item instanceof OpenableList) { listsToClose.add((OpenableList) item); } else { Openable itemOpenable = item.getOpenable(); - enumerateListsToClose(listsToClose, itemOpenable); + enumerateListsToClose(listsToClose, itemOpenable, binaryDataClosedSwfs); } } - if (openable != null) { - enumerateListsToClose(listsToClose, openable); + if (openable != null && !binaryDataClosedSwfs.contains(openable)) { + enumerateListsToClose(listsToClose, openable, binaryDataClosedSwfs); } for (OpenableList list : listsToClose) { Main.closeFile(list);