From bf7412b86a2894ec03e2e838d468113e8164a608 Mon Sep 17 00:00:00 2001 From: caheckman <48068198+caheckman@users.noreply.github.com> Date: Tue, 1 Mar 2022 14:21:49 -0500 Subject: [PATCH] Reset options only on id change --- .../src/main/java/ghidra/program/database/ProgramDB.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/ProgramDB.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/ProgramDB.java index c627eb3799..bbdef27852 100644 --- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/ProgramDB.java +++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/ProgramDB.java @@ -2051,6 +2051,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM setEventsEnabled(false); try { boolean redisassemblyRequired = true; + LanguageID oldLanguageId = languageID; int oldLanguageVersion = languageVersion; int oldLanguageMinorVersion = languageMinorVersion; if (translator != null) { @@ -2079,8 +2080,11 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM if (newCompilerSpecID != null) { compilerSpec = ProgramCompilerSpec.getProgramCompilerSpec(this, language.getCompilerSpecByID(newCompilerSpecID)); - if (compilerSpec instanceof ProgramCompilerSpec) { - ((ProgramCompilerSpec) compilerSpec).resetProgramOptions(monitor); + if (!oldLanguageId.equals(languageID) || + !compilerSpecID.equals(newCompilerSpecID)) { + if (compilerSpec instanceof ProgramCompilerSpec) { + ((ProgramCompilerSpec) compilerSpec).resetProgramOptions(monitor); + } } } compilerSpecID = compilerSpec.getCompilerSpecID();