diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/Freed.java b/trunk/src/com/jpexs/decompiler/flash/gui/Freed.java
new file mode 100644
index 000000000..03fd694cc
--- /dev/null
+++ b/trunk/src/com/jpexs/decompiler/flash/gui/Freed.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2010-2013 JPEXS
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package com.jpexs.decompiler.flash.gui;
+
+/**
+ *
+ * @author JPEXS
+ */
+public interface Freed {
+
+ public void free();
+}
diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java
index 6e30ff80b..82aecee28 100644
--- a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java
+++ b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java
@@ -252,6 +252,11 @@ public class Main {
public static boolean openFile(String swfFile) {
if (mainFrame != null) {
mainFrame.setVisible(false);
+ Helper.emptyObject(mainFrame);
+ swf = null;
+ mainFrame = null;
+ Cache.clearAll();
+ System.gc();
}
Main.file = swfFile;
if (Main.loadingDialog == null) {
diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java
index 4d0ae6e57..98e4820ce 100644
--- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java
+++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java
@@ -185,7 +185,7 @@ import javax.swing.tree.TreeSelectionModel;
*
* @author Jindra
*/
-public class MainFrame extends AppFrame implements ActionListener, TreeSelectionListener {
+public class MainFrame extends AppFrame implements ActionListener, TreeSelectionListener, Freed {
private SWF swf;
public ABCPanel abcPanel;
@@ -422,11 +422,6 @@ public class MainFrame extends AppFrame implements ActionListener, TreeSelection
autoDeobfuscateMenuItem.addActionListener(this);
autoDeobfuscateMenuItem.setActionCommand("AUTODEOBFUSCATE");
-
- /* JCheckBoxMenuItem miSubLimiter = new JCheckBoxMenuItem("Enable sub limiter");
- miSubLimiter.setActionCommand("SUBLIMITER");
- miSubLimiter.addActionListener(this);
- */
JMenuItem miRenameOneIdentifier = new JMenuItem(translate("menu.tools.deobfuscation.globalrename"));
miRenameOneIdentifier.setActionCommand("RENAMEONEIDENTIFIER");
miRenameOneIdentifier.addActionListener(this);
@@ -435,43 +430,10 @@ public class MainFrame extends AppFrame implements ActionListener, TreeSelection
miRenameIdentifiers.setActionCommand("RENAMEIDENTIFIERS");
miRenameIdentifiers.addActionListener(this);
- /*JMenuItem miRemoveDeadCode = new JMenuItem("Remove dead code");
- miRemoveDeadCode.setActionCommand("REMOVEDEADCODE");
- miRemoveDeadCode.addActionListener(this);
-
- JMenuItem miRemoveDeadCodeAll = new JMenuItem("Remove all dead code");
- miRemoveDeadCodeAll.setActionCommand("REMOVEDEADCODEALL");
- miRemoveDeadCodeAll.addActionListener(this);
-
- JMenuItem miTraps = new JMenuItem("Remove traps");
- miTraps.setActionCommand("REMOVETRAPS");
- miTraps.addActionListener(this);
-
- JMenuItem miTrapsAll = new JMenuItem("Remove all traps");
- miTrapsAll.setActionCommand("REMOVETRAPSALL");
- miTrapsAll.addActionListener(this);
-
- JMenuItem miControlFlow = new JMenuItem("Restore control flow");
- miControlFlow.setActionCommand("RESTORECONTROLFLOW");
- miControlFlow.addActionListener(this);
-
- JMenuItem miControlFlowAll = new JMenuItem("Restore all control flow");
- miControlFlowAll.setActionCommand("RESTORECONTROLFLOWALL");
- miControlFlowAll.addActionListener(this);*/
menuDeobfuscation.add(miRenameOneIdentifier);
menuDeobfuscation.add(miRenameIdentifiers);
- //menuDeobfuscation.add(miSubLimiter);
menuDeobfuscation.add(miDeobfuscation);
- /*menuDeobfuscation.add(miDeobfuscate);
- menuDeobfuscation.addSeparator();*/
- /*menuDeobfuscation.add(miRemoveDeadCode);
- menuDeobfuscation.add(miRemoveDeadCodeAll);
- menuDeobfuscation.add(miTraps);
- menuDeobfuscation.add(miTrapsAll);
- menuDeobfuscation.add(miControlFlow);
- menuDeobfuscation.add(miControlFlowAll);
- */
JMenu menuTools = new JMenu(translate("menu.tools"));
JMenuItem miProxy = new JMenuItem(translate("menu.tools.proxy"));
miProxy.setActionCommand("SHOWPROXY");
@@ -580,6 +542,7 @@ public class MainFrame extends AppFrame implements ActionListener, TreeSelection
menuBar.add(menuHelp);
setJMenuBar(menuBar);
+
List