Ghidra is a software reverse engineering (SRE) framework
GT-3280: Fixing ConcurrentModificationException in python interpreter plugin.
Ryan Kurtzdd0551465712
diff --git a/Ghidra/Features/Base/.launch/Ghidra.launch b/Ghidra/Features/Base/.launch/Ghidra.launchindex a47acf5902..2c45f106e2 100644--- a/Ghidra/Features/Base/.launch/Ghidra.launch+++ b/Ghidra/Features/Base/.launch/Ghidra.launch@@ -24,5 +24,5 @@<listAttribute key="org.eclipse.jdt.launching.MODULEPATH"/><stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="ghidra.GhidraRun"/><stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Framework Utility"/>- <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:+IgnoreUnrecognizedVMOptions -Djava.system.class.loader=ghidra.GhidraClassLoader -Dfile.encoding=UTF8 -Duser.country=US -Duser.language=en -Dsun.java2d.pmoffscreen=false -Dsun.java2d.xrender=true -Dsun.java2d.d3d=false -Xdock:name="Ghidra" -Dvisualvm.display.name=Ghidra"/>+ <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:+IgnoreUnrecognizedVMOptions -Djava.system.class.loader=ghidra.GhidraClassLoader -Dfile.encoding=UTF8 -Duser.country=US -Duser.language=en -Dsun.java2d.pmoffscreen=false -Dsun.java2d.xrender=true -Dsun.java2d.d3d=false -Xdock:name="Ghidra" -Dvisualvm.display.name=Ghidra -Dpython.console.encoding=UTF-8"/></launchConfiguration>diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/interpreter/InterpreterComponentProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/interpreter/InterpreterComponentProvider.javaindex a51652fc3a..7823159b83 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/interpreter/InterpreterComponentProvider.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/interpreter/InterpreterComponentProvider.java@@ -171,12 +171,15 @@ public class InterpreterComponentProvider extends ComponentProviderAdapter@Overridepublic void componentActivated() {- // Call the callbacks- firstActivationCallbacks.forEach(l -> l.call());- // Since we only care about the first activation, clear the list- // of callbacks so future activations don't trigger anything.+ // Since we only care about the first activation, clear the list of callbacks so future+ // activations don't trigger anything. First save them off to a local list so when we+ // process them we aren't affected by concurrent modification due to reentrance.+ List<Callback> callbacks = new ArrayList<>(firstActivationCallbacks);firstActivationCallbacks.clear();++ // Call the callbacks+ callbacks.forEach(l -> l.call());}@Overridediff --git a/Ghidra/RuntimeScripts/Common/support/launch.properties b/Ghidra/RuntimeScripts/Common/support/launch.propertiesindex 483bd1511b..be3256a7b1 100644--- a/Ghidra/RuntimeScripts/Common/support/launch.properties+++ b/Ghidra/RuntimeScripts/Common/support/launch.properties@@ -46,6 +46,9 @@ VMARGS=-Dcpu.core.override=# Default font size for many java swing elements.VMARGS=-Dfont.size.override=+# Set Jython console encoding (prevents a console error)+VMARGS=-Dpython.console.encoding=UTF-8+# Eclipse on macOS can have file locking issues if the user home directory is networked. Therefore,# we will disable file locking by default for macOS. Comment the following line out if Eclipse file# locking is needed and known to work.