Ghidra is a software reverse engineering (SRE) framework
GT-3587 corrected creating structure from selection.
ghidra1f94c76c7f56c
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/StructureFactory.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/StructureFactory.javaindex a8e9943642..888ddee346 100644--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/StructureFactory.java+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/StructureFactory.java@@ -55,7 +55,8 @@ public class StructureFactory {* <li>if there are no data components to add to the structure* </ul>*/- public static Structure createStructureDataType(Program program, Address address, int dataLength) {+ public static Structure createStructureDataType(Program program, Address address,+ int dataLength) {return createStructureDataType(program, address, dataLength, DEFAULT_STRUCTURE_NAME, true);}@@ -89,8 +90,8 @@ public class StructureFactory {}if (dataLength <= 0) {- throw new IllegalArgumentException("Structure length must be positive, not " +- dataLength);+ throw new IllegalArgumentException(+ "Structure length must be positive, not " + dataLength);}Address endAddress;@@ -116,7 +117,7 @@ public class StructureFactory {name = providerContext.getUniqueName(name);}- Structure newStructure = new StructureDataType(name, 0);+ Structure newStructure = new StructureDataType(name, 0, program.getDataTypeManager());initializeStructureFromContext(newStructure, providerContext, dataLength);@@ -211,16 +212,15 @@ public class StructureFactory {}// create the context- DataTypeProviderContext providerContext =- new ProgramStructureProviderContext(program, data.getMinAddress(),- (Structure) parentDataType, comp1.getParentOffset());+ DataTypeProviderContext providerContext = new ProgramStructureProviderContext(program,+ data.getMinAddress(), (Structure) parentDataType, comp1.getParentOffset());String name = structureName;if (makeUniqueName) {name = providerContext.getUniqueName(name);}- Structure newStructure = new StructureDataType(name, 0);+ Structure newStructure = new StructureDataType(name, 0, program.getDataTypeManager());initializeStructureFromContext(newStructure, providerContext, dataLength);