mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-19 13:18:24 +00:00
swf disposing fixes
This commit is contained in:
@@ -303,6 +303,35 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
characters = null;
|
||||
}
|
||||
|
||||
public void clearTagSwfs() {
|
||||
resetTimelines(this);
|
||||
updateCharacters();
|
||||
|
||||
for (Tag tag : tags) {
|
||||
if (tag instanceof DefineSpriteTag) {
|
||||
DefineSpriteTag spriteTag = (DefineSpriteTag) tag;
|
||||
for (Tag tag1 : spriteTag.subTags) {
|
||||
tag1.setSwf(null);
|
||||
}
|
||||
|
||||
spriteTag.subTags.clear();
|
||||
}
|
||||
|
||||
tag.setSwf(null);
|
||||
}
|
||||
|
||||
tags.clear();
|
||||
abcList.clear();
|
||||
|
||||
as2Cache.clear();
|
||||
as3Cache.clear();
|
||||
|
||||
timeline = null;
|
||||
dumpInfo = null;
|
||||
jtt = null;
|
||||
binaryData = null;
|
||||
}
|
||||
|
||||
public Map<Integer, CharacterTag> getCharacters() {
|
||||
if (characters == null) {
|
||||
synchronized (this) {
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.helpers;
|
||||
import com.jpexs.decompiler.flash.helpers.Freed;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -35,7 +36,7 @@ public class Cache<K, V> implements Freed {
|
||||
|
||||
private Map<K, V> cache;
|
||||
|
||||
private static final List<Cache> instances = new ArrayList<>();
|
||||
private static final List<WeakReference<Cache>> instances = new ArrayList<>();
|
||||
|
||||
public static final int STORAGE_FILES = 1;
|
||||
|
||||
@@ -52,9 +53,12 @@ public class Cache<K, V> implements Freed {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (Cache c : instances) {
|
||||
c.clear();
|
||||
c.free();
|
||||
for (WeakReference<Cache> cw : instances) {
|
||||
Cache c = cw.get();
|
||||
if (c != null) {
|
||||
c.clear();
|
||||
c.free();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,16 +67,19 @@ public class Cache<K, V> implements Freed {
|
||||
|
||||
public static <K, V> Cache<K, V> getInstance(boolean weak, boolean memoryOnly, String name) {
|
||||
Cache<K, V> instance = new Cache<>(weak, memoryOnly, name);
|
||||
instances.add(instance);
|
||||
instances.add(new WeakReference<Cache>(instance));
|
||||
return instance;
|
||||
}
|
||||
|
||||
private static int storageType = STORAGE_FILES;
|
||||
|
||||
public static void clearAll() {
|
||||
for (Cache c : instances) {
|
||||
c.clear();
|
||||
c.initCache();
|
||||
for (WeakReference<Cache> cw : instances) {
|
||||
Cache c = cw.get();
|
||||
if (c != null) {
|
||||
c.clear();
|
||||
c.initCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -855,6 +855,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
|
||||
|
||||
public synchronized void clearAll() {
|
||||
stop();
|
||||
clearImagePanel();
|
||||
timelined = null;
|
||||
swf = null;
|
||||
}
|
||||
|
||||
@@ -725,6 +725,11 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
}
|
||||
}
|
||||
|
||||
/*for (SWFList swfList : swfs) {
|
||||
for (SWF swf : swfList) {
|
||||
swf.clearTagSwfs();
|
||||
}
|
||||
}*/
|
||||
swfs.clear();
|
||||
oldItem = null;
|
||||
previewPanel.clear();
|
||||
@@ -2442,6 +2447,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
setSourceWorker = null;
|
||||
try {
|
||||
get();
|
||||
} catch (CancellationException ex) {
|
||||
|
||||
@@ -286,6 +286,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
this.abc = null;
|
||||
constantTable.setModel(new DefaultTableModel());
|
||||
navigator.clearAbc();
|
||||
decompiledTextArea.clearScript();
|
||||
}
|
||||
|
||||
public void initSplits() {
|
||||
|
||||
@@ -639,6 +639,10 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
|
||||
this.abcPanel = abcPanel;
|
||||
}
|
||||
|
||||
public void clearScript() {
|
||||
script = null;
|
||||
}
|
||||
|
||||
public void setScript(ScriptPack scriptLeaf) {
|
||||
abcPanel.scriptNameLabel.setText(scriptLeaf.getClassPath().toString());
|
||||
int scriptIndex = scriptLeaf.scriptIndex;
|
||||
|
||||
Reference in New Issue
Block a user