From ffbfecdee9e2c733824445b650463ac1ddd24cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 9 Nov 2014 14:12:36 +0100 Subject: [PATCH] run memory fix typeitem deobfuscation cache synchronization fix --- build.xml | 2 +- build_common.xml | 2 -- .../src/com/jpexs/decompiler/graph/TypeItem.java | 5 +++-- libsrc/ffdec_lib/src/com/jpexs/helpers/Cache.java | 10 +++++----- .../flash/gui/abc/DecompiledEditorPane.java | 12 ++++++------ 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/build.xml b/build.xml index 259fa27ab..09aca82c2 100644 --- a/build.xml +++ b/build.xml @@ -23,7 +23,7 @@ - + diff --git a/build_common.xml b/build_common.xml index 3605f7118..c1b03b151 100644 --- a/build_common.xml +++ b/build_common.xml @@ -454,8 +454,6 @@ - - diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TypeItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TypeItem.java index 6eb0a8596..abdfb9724 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TypeItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/TypeItem.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.graph; +import com.jpexs.decompiler.flash.IdentifiersDeobfuscation; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.types.InstanceInfo; @@ -77,13 +78,13 @@ public class TypeItem extends GraphTargetItem { @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { if (localData.fullyQualifiedNames.contains(fullTypeName)) { - writer.hilightSpecial(fullTypeName,"typename",fullTypeName); + writer.hilightSpecial(IdentifiersDeobfuscation.printNamespace(localData.constantsAvm2!=null, fullTypeName),"typename",fullTypeName); } else { String simpleName = fullTypeName; if (simpleName.contains(".")) { simpleName = simpleName.substring(simpleName.lastIndexOf('.') + 1); } - writer.hilightSpecial(simpleName,"typename",fullTypeName); + writer.hilightSpecial(IdentifiersDeobfuscation.printNamespace(localData.constantsAvm2!=null, simpleName),"typename",fullTypeName); } return writer; diff --git a/libsrc/ffdec_lib/src/com/jpexs/helpers/Cache.java b/libsrc/ffdec_lib/src/com/jpexs/helpers/Cache.java index 142bcf6fe..2e0a4bcbb 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/helpers/Cache.java +++ b/libsrc/ffdec_lib/src/com/jpexs/helpers/Cache.java @@ -90,7 +90,7 @@ public class Cache { } } - public boolean contains(K key) { + public synchronized boolean contains(K key) { if (storageType == STORAGE_FILES) { return cacheFiles.containsKey(key); } else if (storageType == STORAGE_MEMORY) { @@ -99,7 +99,7 @@ public class Cache { return false; } - public void clear() { + public synchronized void clear() { cacheMemory.clear(); for (File f : cacheFiles.values()) { f.delete(); @@ -107,7 +107,7 @@ public class Cache { cacheFiles.clear(); } - public void remove(K key) { + public synchronized void remove(K key) { if (storageType == STORAGE_FILES) { if (cacheFiles.containsKey(key)) { File f = cacheFiles.get(key); @@ -122,7 +122,7 @@ public class Cache { } - public V get(K key) { + public synchronized V get(K key) { if (storageType == STORAGE_FILES) { if (!cacheFiles.containsKey(key)) { return null; @@ -146,7 +146,7 @@ public class Cache { return null; } - public void put(K key, V value) { + public synchronized void put(K key, V value) { if (storageType == STORAGE_FILES) { File temp = null; try { diff --git a/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java b/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java index 0ee2494f6..bae99b95a 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java @@ -293,7 +293,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL return -1; } - public boolean getPropertyTypeAtPos(int pos, Reference abcIndex,Reference classIndex, Reference traitIndex, Reference classTrait, Reference multinameIndex){ + public boolean getPropertyTypeAtPos(int pos, Reference abcIndex,Reference classIndex, Reference traitIndex, Reference classTrait, Reference multinameIndex){ int m = getMultinameAtPos(pos,true); if (m <= 0) { @@ -303,7 +303,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL Token t = sd.getTokenAt(pos+1); Token lastToken = t; Token prev = null; - while(t.type == TokenType.IDENTIFIER || t.type == TokenType.KEYWORD){ + while(t.type == TokenType.IDENTIFIER || t.type == TokenType.KEYWORD || t.type == TokenType.REGEX){ prev = sd.getPrevToken(t); if(prev!=null){ if(!".".equals(prev.getString(sd))){ @@ -314,7 +314,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL break; } } - if(t.type != TokenType.IDENTIFIER && t.type != TokenType.KEYWORD){ + if(t.type != TokenType.IDENTIFIER && t.type != TokenType.KEYWORD || t.type == TokenType.REGEX){ return false; } Reference locTypeRef = new Reference<>(""); @@ -336,7 +336,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL InstanceInfo ii = a.instance_info.get(cindex); for(int j=0;j(), true))){ + if(ident.equals(tr.getName(a).getName(a.constants, new ArrayList(), false /*NOT RAW!*/))){ classIndex.setVal(cindex); abcIndex.setVal(i); traitIndex.setVal(j); @@ -351,7 +351,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL ClassInfo ci = a.class_info.get(cindex); for(int j=0;j(), true))){ + if(ident.equals(tr.getName(a).getName(a.constants, new ArrayList(), false /*NOT RAW!*/))){ classIndex.setVal(cindex); abcIndex.setVal(i); traitIndex.setVal(j); @@ -464,7 +464,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL break; case "traitname": if (currentTrait != null) { - return currentTrait.name_index; + //return currentTrait.name_index; } break; case "returns":