Fixed: Frozing after closing SWF file caused by incorrect freeing memory

This commit is contained in:
Jindra Petřík
2025-05-27 06:47:47 +02:00
parent 9cd6a203fe
commit fe516a04d6
3 changed files with 5 additions and 7 deletions
@@ -275,7 +275,7 @@ public class TagListTreeModel extends AbstractTagTreeModel {
for (SWF swf : toRemove) {
swfHeaders.remove(swf);
removeFromCache(swf);
uncacheSwf(swf);
}
}
@@ -50,13 +50,11 @@ public abstract class AbstractTagTreeModel implements TreeModel {
protected Map<TreeItem, TreeItem> itemToParentCache = new WeakHashMap<>();
protected void removeFromCache(TreeItem itemToRemove) {
itemToParentCache.remove(itemToRemove);
protected void uncacheSwf(SWF swf) {
Set<TreeItem> tSet = new HashSet<>(itemToParentCache.keySet());
for (TreeItem item : tSet) {
TreeItem parent = itemToParentCache.get(item);
if (parent == itemToRemove) {
removeFromCache(item);
if (item.getOpenable() == swf) {
itemToParentCache.remove(item);
}
}
}
@@ -161,7 +161,7 @@ public class TagTreeModel extends AbstractTagTreeModel {
for (SWF swf : toRemove) {
swfInfos.remove(swf);
removeFromCache(swf);
uncacheSwf(swf);
}
}