Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-2871 - Fixed property editor initialization to always be on the Swing thread

dragonmacher68a2e60d3f87
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/options/editor/EditorInitializer.java b/Ghidra/Framework/Docking/src/main/java/docking/options/editor/EditorInitializer.java
index 2797190d96..8f95853103 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/options/editor/EditorInitializer.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/options/editor/EditorInitializer.java
@@ -15,25 +15,31 @@
*/
package docking.options.editor;
-import ghidra.framework.ModuleInitializer;
-import ghidra.framework.options.EnumEditor;
-import ghidra.util.Swing;
-
import java.awt.Color;
import java.awt.Font;
import java.beans.PropertyEditorManager;
import java.io.File;
import java.util.Date;
+import ghidra.framework.ModuleInitializer;
+import ghidra.framework.options.EnumEditor;
+import ghidra.util.Swing;
+
public class EditorInitializer implements ModuleInitializer {
@Override
public void run() {
- // running this on the Swing thread ensures the SwingThread's ThreadGroupContext is used
- // when PropertyEditorManager obtains the PropertyEditorFinder during registration
+ //
+ // The PropertyEditorManager uses thread-specific context when registering and finding
+ // property editors. This method is called on the application loading thread, not the
+ // Swing thread. Further, property editors are used by the application from the Swing
+ // thread. Thus, it is possible that the Swing thread cannot see editors registered from
+ // the application thread. Running this on the Swing thread ensures the Swing thread's
+ // ThreadGroupContext is used.
+ //
Swing.runNow(this::registerEditors);
}
-
+
private void registerEditors() {
PropertyEditorManager.registerEditor(String.class, StringEditor.class);
PropertyEditorManager.registerEditor(Color.class, ColorEditor.class);