Ghidra is a software reverse engineering (SRE) framework
Test fix for timing issue on tear down
dragonmacher2a6f0103b0b1
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/filechooser/GhidraFileChooser.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/filechooser/GhidraFileChooser.javaindex bf9cfd4ead..84936ab8df 100644--- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/filechooser/GhidraFileChooser.java+++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/filechooser/GhidraFileChooser.java@@ -1063,11 +1063,15 @@ public class GhidraFileChooser extends ReusableDialogComponentProvider implement@Overridepublic void close() {+ closeCleanup();+ super.close();+ }++ private void closeCleanup() {clearBackHistory();cancelEdits();clearStatusText();savePreferences();- super.close();}private void savePreferences() {@@ -1511,9 +1515,12 @@ public class GhidraFileChooser extends ReusableDialogComponentProvider implement@Overridepublic void dispose() {+ super.dispose();+ closeCleanup();+ modelUpdater.dispose();actionManager.dispose();optionsDialog.dispose();- close();+worker.dispose();fileChooserModel = null;}@@ -1956,8 +1963,17 @@ public class GhidraFileChooser extends ReusableDialogComponentProvider implement@Overridepublic void run(TaskMonitor monitor) {+ if (monitor.isCancelled()) {+ return;+ }+run();- SystemUtilities.runSwingLater(() -> runSwing());++ Swing.runLater(() -> {+ if (!monitor.isCancelled()) {+ runSwing();+ }+ });}public void run() {@@ -2023,10 +2039,6 @@ public class GhidraFileChooser extends ReusableDialogComponentProvider implement@Overridepublic void run() {- if (fileChooserModel == null) {- return;- }-loadedFiles =new ArrayList<>(fileChooserModel.getListing(directory, GhidraFileChooser.this));Collections.sort(loadedFiles, new FileComparator(fileChooserModel));@@ -2055,9 +2067,6 @@ public class GhidraFileChooser extends ReusableDialogComponentProvider implement@Overridepublic void run() {- if (fileChooserModel == null) {- return;- }roots = new ArrayList<>(fileChooserModel.getRoots(forceUpdate));Collections.sort(roots);}diff --git a/Ghidra/Framework/Gui/src/main/java/ghidra/util/filechooser/GhidraFileChooserModel.java b/Ghidra/Framework/Gui/src/main/java/ghidra/util/filechooser/GhidraFileChooserModel.javaindex 3d48a621b4..83a4fa8133 100644--- a/Ghidra/Framework/Gui/src/main/java/ghidra/util/filechooser/GhidraFileChooserModel.java+++ b/Ghidra/Framework/Gui/src/main/java/ghidra/util/filechooser/GhidraFileChooserModel.java@@ -15,10 +15,9 @@*/package ghidra.util.filechooser;-import java.util.List;-import java.io.File;import java.io.FileFilter;+import java.util.List;import javax.swing.Icon;@@ -71,6 +70,7 @@ public interface GhidraFileChooserModel {* exist in the specified directory.** @param directory the directory+ * @param filter the file filter; may be null* @return list of files*/public List<File> getListing(File directory, FileFilter filter);@@ -100,8 +100,8 @@ public interface GhidraFileChooserModel {public boolean createDirectory(File directory, String name);/**- * Tests whether the file denoted by this abstract pathname is a- * directory.+ * Tests whether the file denoted by this abstract pathname is a directory.+ * @param file the file* @return <code>true</code> if and only if the file denoted by this* abstract pathname exists <em>and</em> is a directory;* <code>false</code> otherwise@@ -114,13 +114,14 @@ public interface GhidraFileChooserModel {* absolute if its prefix is <code>"/"</code>. On Microsoft Windows systems, a* pathname is absolute if its prefix is a drive specifier followed by* <code>"\\"</code>, or if its prefix is <code>"\\"</code>.+ * @param file the file* @return <code>true</code> if this abstract pathname is absolute,* <code>false</code> otherwise*/public boolean isAbsolute(File file);/**- * Renames the src file to the dest file.+ * Renames the src file to the destination file.* @param src the file to be renamed* @param dest the new file* @return true if the file was renamed