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 d56aa8793..a214d633d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -318,12 +318,24 @@ public final class SWF implements SWFContainerItem, Timelined { spriteTag.subTags.clear(); } + if (tag instanceof DefineBinaryDataTag) { + DefineBinaryDataTag binaryTag = (DefineBinaryDataTag) tag; + if (binaryTag.innerSwf != null) { + binaryTag.innerSwf.clearTagSwfs(); + } + } + tag.setSwf(null); } tags.clear(); - abcList.clear(); - swfList.swfs.clear(); + if (abcList != null) { + abcList.clear(); + } + + if (swfList != null) { + swfList.swfs.clear(); + } as2Cache.clear(); as3Cache.clear(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/BinaryDataImporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/BinaryDataImporter.java index abee251b4..ff7cc6587 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/BinaryDataImporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/BinaryDataImporter.java @@ -1,18 +1,19 @@ /* * Copyright (C) 2010-2015 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.importers; import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag; @@ -26,6 +27,7 @@ public class BinaryDataImporter extends TagImporter { public void importData(DefineBinaryDataTag binaryDataTag, byte[] newData) { binaryDataTag.binaryData = new ByteArrayRange(newData); + binaryDataTag.innerSwf = null; binaryDataTag.setModified(true); } } diff --git a/libsrc/ffdec_lib/testdata/zipped.zip b/libsrc/ffdec_lib/testdata/zipped.zip new file mode 100644 index 000000000..6ed391c34 Binary files /dev/null and b/libsrc/ffdec_lib/testdata/zipped.zip differ diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 4287fe99e..5f3299b57 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -778,12 +778,13 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec } } - /*for (SWFList swfList : swfs) { - List swfs2 = new ArrayList<>(swfList); - for (SWF swf : swfs2) { - swf.clearTagSwfs(); - } - }*/ + for (SWFList swfList : swfs) { + List swfs2 = new ArrayList<>(swfList); + for (SWF swf : swfs2) { + swf.clearTagSwfs(); + } + } + swfs.clear(); oldItem = null; clear(); @@ -807,6 +808,11 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec } } + List swfs2 = new ArrayList<>(swfList); + for (SWF swf : swfs2) { + swf.clearTagSwfs(); + } + swfs.remove(swfList); oldItem = null; clear(); @@ -2158,6 +2164,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec File selfile = Helper.fixDialogFile(selectedFile); byte[] data = Helper.readFile(selfile.getAbsolutePath()); new BinaryDataImporter().importData(bt, data); + refreshTree(bt.getSwf()); reload(true); } } diff --git a/src/com/jpexs/decompiler/flash/gui/View.java b/src/com/jpexs/decompiler/flash/gui/View.java index 426781298..e1403109c 100644 --- a/src/com/jpexs/decompiler/flash/gui/View.java +++ b/src/com/jpexs/decompiler/flash/gui/View.java @@ -496,7 +496,7 @@ public class View { } expandedNodes.add(pathAsStringList); } - } catch (IndexOutOfBoundsException ex) { + } catch (IndexOutOfBoundsException | NullPointerException ex) { // TreeNode was removed, ignore } } diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java index e66987fad..1d5803170 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java @@ -554,6 +554,7 @@ public class TagTreeContextMenu extends JPopupMenu implements ActionListener { if (swf.binaryData != null) { // embedded swf swf.binaryData.innerSwf = null; + swf.clearTagSwfs(); mainPanel.refreshTree(null); } else { Main.closeFile(swf.swfList);