diff --git a/CHANGELOG.md b/CHANGELOG.md index 97141c42e..3294c44bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ All notable changes to this project will be documented in this file. - XML Import - not set SWF and Timelined internal values caused an exception on item display - Goto usage exception and incorrect trait position - [#1648] Search - loaded search results mixed +- [#1650] Empty search results from history after reloading SWF file ## [14.1.0] - 2021-03-05 ### Added @@ -2098,6 +2099,7 @@ All notable changes to this project will be documented in this file. [#1647]: https://www.free-decompiler.com/flash/issues/1647 [#1332]: https://www.free-decompiler.com/flash/issues/1332 [#1648]: https://www.free-decompiler.com/flash/issues/1648 +[#1650]: https://www.free-decompiler.com/flash/issues/1650 [#1561]: https://www.free-decompiler.com/flash/issues/1561 [#1623]: https://www.free-decompiler.com/flash/issues/1623 [#1622]: https://www.free-decompiler.com/flash/issues/1622 diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index 1af4cdaf4..844f5ac40 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -46,6 +46,7 @@ import com.jpexs.decompiler.flash.gui.debugger.DebuggerTools; import com.jpexs.decompiler.flash.gui.pipes.FirstInstance; import com.jpexs.decompiler.flash.gui.proxy.ProxyFrame; import com.jpexs.decompiler.flash.helpers.SWFDecompilerPlugin; +import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.base.FontTag; import com.jpexs.decompiler.flash.tags.base.ImportTag; @@ -720,6 +721,18 @@ public class Main { }); } + public static void populateSwfs(SWF swfParent, List output) { + for (Tag t : swfParent.getTags()) { + if (t instanceof DefineBinaryDataTag) { + DefineBinaryDataTag b = (DefineBinaryDataTag) t; + if (b.innerSwf != null) { + output.add(b.innerSwf); + populateSwfs(b.innerSwf, output); + } + } + } + } + public static SWFList parseSWF(SWFSourceInfo sourceInfo) throws Exception { SWFList result = new SWFList(); diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 02f5d395c..31fc5510a 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -825,6 +825,19 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se public void loadSwfAtPos(SWFList newSwfs, int index) { View.checkAccess(); + SWFList oldSwfList = swfs.get(index); + + List allSwfs = new ArrayList<>(); + for (SWF s : oldSwfList.swfs) { + allSwfs.add(s); + Main.populateSwfs(s, allSwfs); + } + + for (SWF s : allSwfs) { + s.clearTagSwfs(); + Main.searchResultsStorage.destroySwf(s); + } + List> expandedNodes = View.getExpandedNodes(tagTree); previewPanel.clear(); swfs.set(index, newSwfs); @@ -1007,7 +1020,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se List swfsToClose = new ArrayList<>(); swfsToClose.addAll(swfList); for (SWF swf : swfList) { - populateSwfs(swf, swfsToClose); + Main.populateSwfs(swf, swfsToClose); } for (int i = 0; i < searchResultsDialogs.size(); i++) { @@ -1805,24 +1818,13 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } } - private void populateSwfs(SWF swfParent, List output) { - for (Tag t : swfParent.getTags()) { - if (t instanceof DefineBinaryDataTag) { - DefineBinaryDataTag b = (DefineBinaryDataTag) t; - if (b.innerSwf != null) { - output.add(b.innerSwf); - populateSwfs(b.innerSwf, output); - } - } - } - } public Set getAllSwfs() { List allSwfs = new ArrayList<>(); for (SWFList slist : getSwfs()) { for (SWF s : slist.swfs) { allSwfs.add(s); - populateSwfs(s, allSwfs); + Main.populateSwfs(s, allSwfs); } } return new LinkedHashSet<>(allSwfs);