Issue #850 Constant initializing in initializer for equal Multinames, not same multinameIndex only

GUI dispatch thread fix
This commit is contained in:
Jindra Petřík
2015-05-31 06:26:33 +02:00
parent 7e4f4f67ad
commit 1e6d369d32
4 changed files with 1332 additions and 1275 deletions

View File

@@ -698,7 +698,7 @@ public class AVM2Code implements Cloneable {
if (ins.definition instanceof NewFunctionIns) {
//Only analyze NewFunction objects that are not immediately discarded by Pop.
//This avoids bogus functions used in obfuscation or special compilers that can lead to infinite recursion.
if ((pos+1 < code.size()) && !(code.get(pos+1).definition instanceof PopIns)) {
if ((pos + 1 < code.size()) && !(code.get(pos + 1).definition instanceof PopIns)) {
MethodBody innerBody = abc.findBody(ins.operands[0]);
innerBody.getCode().calculateDebugFileLine(debugFile, debugLine, 0, abc, new HashSet<Integer>());
}
@@ -1705,8 +1705,11 @@ public class AVM2Code implements Cloneable {
multinameIndex = ((FullMultinameAVM2Item) ((SetPropertyAVM2Item) ti).propertyName).multinameIndex;
value = ((SetPropertyAVM2Item) ti).value;
}
Multiname m = abc.constants.getMultiname(multinameIndex);
for (Trait t : initTraits.traits) {
if (t.name_index == multinameIndex) {
Multiname tm = abc.constants.getMultiname(t.name_index);
if (tm != null && tm.equals(m)) {
if ((t instanceof TraitSlotConst)) {
if (((TraitSlotConst) t).isConst() || isStaticInitializer) {
if ((((TraitSlotConst) t).assignedValue) == null) {

View File

@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.types.annotations.Internal;
import com.jpexs.helpers.Helper;
import java.util.List;
import java.util.Objects;
public class Multiname {
@@ -323,4 +324,47 @@ public class Multiname {
return constants.getNamespaceSet(namespace_set_index);
}
}
@Override
public int hashCode() {
int hash = 7;
hash = 53 * hash + this.kind;
hash = 53 * hash + this.name_index;
hash = 53 * hash + this.namespace_index;
hash = 53 * hash + this.namespace_set_index;
hash = 53 * hash + this.qname_index;
hash = 53 * hash + Objects.hashCode(this.params);
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Multiname other = (Multiname) obj;
if (this.kind != other.kind) {
return false;
}
if (this.name_index != other.name_index) {
return false;
}
if (this.namespace_index != other.namespace_index) {
return false;
}
if (this.namespace_set_index != other.namespace_set_index) {
return false;
}
if (this.qname_index != other.qname_index) {
return false;
}
if (!Objects.equals(this.params, other.params)) {
return false;
}
return true;
}
}