Ghidra is a software reverse engineering (SRE) framework
Test fixes
dragonmacher55dde0de4aa5
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/CreateEquateCmd.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/CreateEquateCmd.javaindex 43e02c55c2..7fee66677f 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/CreateEquateCmd.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/CreateEquateCmd.java@@ -15,6 +15,8 @@*/package ghidra.app.plugin.core.equate;+import java.util.Objects;+import ghidra.app.cmd.equate.SetEquateCmd;import ghidra.app.context.ListingActionContext;import ghidra.framework.cmd.BackgroundCommand;@@ -57,7 +59,7 @@ public class CreateEquateCmd extends BackgroundCommand {false /* is modal */);this.targetScalarValue = scalar.getValue();this.iterator = iter;- this.equateName = equateName;+ this.equateName = Objects.requireNonNull(equateName);this.overwriteExisting = overwriteExisting;this.context = context;}@@ -78,7 +80,7 @@ public class CreateEquateCmd extends BackgroundCommand {this.iterator = iter;this.overwriteExisting = overwriteExisting;this.context = context;- this.enoom = enoom;+ this.enoom = Objects.requireNonNull(enoom);}@Overridediff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bean/SetEquateDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bean/SetEquateDialog.javaindex 659a2c8337..9f96c45845 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bean/SetEquateDialog.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bean/SetEquateDialog.java@@ -90,6 +90,10 @@ public class SetEquateDialog extends DialogComponentProvider {private EquateFilterListener filterListener = new EquateFilterListener();private EquateEnterListener enterListener = new EquateEnterListener();+ // these will be set in the okCallback()+ private String equateName;+ private Enum enumDt;+/*** Constructor*@@ -148,12 +152,14 @@ public class SetEquateDialog extends DialogComponentProvider {int refCount = eqRowObject.getRefCount();if (refCount > 0) {if (eqRowObject.getEntryName().contains(EquateManager.ERROR_TAG)) {- c.setForeground(isSelected ? this.SELECTED_CELL_COLOR : this.BAD_EQUATE_COLOR);+ c.setForeground(+ isSelected ? this.SELECTED_CELL_COLOR : this.BAD_EQUATE_COLOR);}else {Equate e = eqRowObject.getEquate();if (e != null && !e.isEnumBased()) {- c.setForeground(isSelected ? this.SELECTED_CELL_COLOR : this.EQUATE_COLOR);+ c.setForeground(+ isSelected ? this.SELECTED_CELL_COLOR : this.EQUATE_COLOR);}}}@@ -397,6 +403,10 @@ public class SetEquateDialog extends DialogComponentProvider {* Get the Equate Name entered or chosen by the user.*/public String getEquateName() {+ return equateName;+ }++ private String doGetEquateName() {EquateRowObject equateEntry = getRowObject();if (equateEntry != null) {return equateEntry.getEntryName();@@ -413,6 +423,10 @@ public class SetEquateDialog extends DialogComponentProvider {* @return the enum data type for the selected entry, or null if there is no enum.*/public Enum getEnumDataType() {+ return enumDt;+ }++ private Enum doGetEnumDataType() {EquateRowObject equateEntry = getRowObject();return (equateEntry != null) ? equateEntry.getEnumDataType() : null;}@@ -515,8 +529,11 @@ public class SetEquateDialog extends DialogComponentProvider {@Overrideprotected void okCallback() {- if (isValid(this.getEquateName(), scalar)) {+ String name = doGetEquateName();+ if (isValid(name, scalar)) {result = OK;+ equateName = name;+ enumDt = doGetEnumDataType();close();}else {@@ -532,7 +549,7 @@ public class SetEquateDialog extends DialogComponentProvider {// look up the new equate stringEquate newEquate = equateTable.getEquate(equateStr);- if (newEquate != null && getEnumDataType() == null) {+ if (newEquate != null && doGetEnumDataType() == null) {// make sure any existing equate with that name has the same value.if (newEquate.getValue() != testScalar.getValue()) {setStatus("Equate " + equateStr + " exists with value 0x" +diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/dialogs/SettingsDialog.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/dialogs/SettingsDialog.javaindex 232f6e783d..52077f363a 100644--- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/dialogs/SettingsDialog.java+++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/dialogs/SettingsDialog.java@@ -37,7 +37,7 @@ import ghidra.util.HelpLocation;import ghidra.util.exception.AssertException;public class SettingsDialog extends DialogComponentProvider {-+private final static int WIDTH = 300;private final static int HEIGHT = 150;@@ -70,11 +70,12 @@ public class SettingsDialog extends DialogComponentProvider {DockingWindowManager.showDialog(parent, this);}+ @Overridepublic void dispose() {settingsTable.editingStopped(null);settingsTable.dispose();- close();+ super.dispose();settingsDefs = null;settings = null;}