Skip to content

Ghidra is a software reverse engineering (SRE) framework

Test fix for recent test framework change. Allow re-entrant Swing thread calls

dragonmacher316e32820d64
diff --git a/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGenericTest.java b/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGenericTest.java
index fb1a261971..30c5b66be3 100644
--- a/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGenericTest.java
+++ b/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGenericTest.java
@@ -1136,6 +1136,20 @@ public abstract class AbstractGenericTest extends AbstractGTest {
public static void runSwing(Runnable runnable, boolean wait) {
+ //
+ // Special Case: this check handled re-entrant test code. That is, an calls to runSwing()
+ // that are made from within a runSwing() call. Most clients do not do
+ // this, but it can happen when a client makes a test API call (which itself
+ // calls runSwing()) from within a runSwing() call.
+ //
+ // Calling the run method directly here ensures that the order of client
+ // requests is preserved.
+ //
+ if (SwingUtilities.isEventDispatchThread()) {
+ runnable.run();
+ return;
+ }
+
if (wait) {
runSwingAndWait(runnable);
return;