Ghidra is a software reverse engineering (SRE) framework
GP-676 - Tweak to the TableChooserDialog API to always use a transaction
dragonmacherd4302549e3cc
diff --git a/Ghidra/Features/Base/ghidra_scripts/FindSharedReturnFunctionsScript.java b/Ghidra/Features/Base/ghidra_scripts/FindSharedReturnFunctionsScript.javaindex 323205253c..313bc1f113 100644--- a/Ghidra/Features/Base/ghidra_scripts/FindSharedReturnFunctionsScript.java+++ b/Ghidra/Features/Base/ghidra_scripts/FindSharedReturnFunctionsScript.java@@ -152,11 +152,6 @@ public class FindSharedReturnFunctionsScript extends GhidraScript {return "Fixup SharedReturn";}- @Override- public boolean useBulkTransaction() {- return true;- }-@Overridepublic boolean execute(AddressableRowObject rowObject) {SharedReturnLocations sharedRetLoc = (SharedReturnLocations) rowObject;diff --git a/Ghidra/Features/Base/ghidra_scripts/FixupNoReturnFunctionsScript.java b/Ghidra/Features/Base/ghidra_scripts/FixupNoReturnFunctionsScript.javaindex 3eae29e63b..49b7b136c8 100644--- a/Ghidra/Features/Base/ghidra_scripts/FixupNoReturnFunctionsScript.java+++ b/Ghidra/Features/Base/ghidra_scripts/FixupNoReturnFunctionsScript.java@@ -271,11 +271,6 @@ public class FixupNoReturnFunctionsScript extends GhidraScript {return "Fixup NoReturn";}- @Override- public boolean useBulkTransaction() {- return true;- }-@Overridepublic boolean execute(AddressableRowObject rowObject) {NoReturnLocations noRetLoc = (NoReturnLocations) rowObject;diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/tablechooser/TableChooserDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/app/tablechooser/TableChooserDialog.javaindex 720a5ce4a4..b9ddf2cacf 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/tablechooser/TableChooserDialog.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/tablechooser/TableChooserDialog.java@@ -242,13 +242,7 @@ public class TableChooserDialog extends DialogComponentProvidermonitor.initialize(rowObjects.size());try {- List<AddressableRowObject> deleted;- if (executor.useBulkTransaction()) {- deleted = doProcessRowsInTransaction(rowObjects, monitor);- }- else {- deleted = doProcessRows(rowObjects, monitor);- }+ List<AddressableRowObject> deleted = doProcessRowsInTransaction(rowObjects, monitor);for (AddressableRowObject rowObject : deleted) {model.removeObject(rowObject);diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/tablechooser/TableChooserExecutor.java b/Ghidra/Features/Base/src/main/java/ghidra/app/tablechooser/TableChooserExecutor.javaindex 9eca7be7d4..3414ea8f59 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/tablechooser/TableChooserExecutor.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/tablechooser/TableChooserExecutor.java@@ -19,9 +19,6 @@ package ghidra.app.tablechooser;* The interface clients must implement to use the {@link TableChooserDialog}. This class is the* callback that is used to process items from the dialog's table as users select one or more* rows in the table and then press the table's "apply" button.- *- * <P>See the notes on {@link #useBulkTransaction()}. We recommend you override that method to- * return true.*/public interface TableChooserExecutor {@@ -37,34 +34,11 @@ public interface TableChooserExecutor {* Applies this executors action to the given rowObject. Return true if the given object* should be removed from the table.*+ * <P>This method call will be wrapped in a transaction so the client does not have to do so.+ * Multiple selected rows will all be processed in a single transaction.+ ** @param rowObject the AddressRowObject to be executed upon* @return true if the rowObject should be removed from the table, false otherwise*/public boolean execute(AddressableRowObject rowObject);-- /**- * When true, the calls to {@link #execute(AddressableRowObject)} will be wrapped in a- * transaction. This allows clients to not use transactions themselves. This can increase- * performance when the user selects a large number of rows in the table to be executed, as- * this API will only use on transaction for all rows, instead of one per row.- *- * <P>When true, this will use one transaction per button press of the- * {@link TableChooserDialog}. Thus, if the user only processes a single row per button- * press, then there is no performance gain over the traditional use of transactions.- *- * <P><B>We recommend clients override this method to return true</B>.- *- * <P>Note: when false is returned from this method, <b>no transaction is created before the- * call to {@link #execute(AddressableRowObject)}</b>--the client is responsible for- * transaction management in this case.- *- * <P>For backward compatibility, this method defaults to returning false. You must override- * this method to return true in your code to make use of the single bulk transaction.- *- * @return true to use bulk transactions; false to use no transaction at all when calling- * {@link #execute(AddressableRowObject)}; default is false- */- public default boolean useBulkTransaction() {- return false; // false by default for backward compatibility- }}diff --git a/Ghidra/Features/Decompiler/ghidra_scripts/ShowConstantUse.java b/Ghidra/Features/Decompiler/ghidra_scripts/ShowConstantUse.javaindex d2d8d09886..3123a67e19 100644--- a/Ghidra/Features/Decompiler/ghidra_scripts/ShowConstantUse.java+++ b/Ghidra/Features/Decompiler/ghidra_scripts/ShowConstantUse.java@@ -311,11 +311,6 @@ public class ShowConstantUse extends GhidraScript {return "Create Structure";}- @Override- public boolean useBulkTransaction() {- return true;- }-@Overridepublic boolean execute(AddressableRowObject rowObject) {ConstUseLocation constLoc = (ConstUseLocation) rowObject;