diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerController.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerController.java index 75102adc56..d3cb23c7ce 100644 --- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerController.java +++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerController.java @@ -207,6 +207,14 @@ public class DecompilerController { decompilerMgr.resetDecompiler(); } + /** + * Adds the given data to the cache. Meant for internal use only. + * @param data the data + */ + public void addToCache(DecompileData data) { + updateCache(data); + } + //================================================================================================== // Methods call by the DecompilerManager //================================================================================================== diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/DecompilerProvider.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/DecompilerProvider.java index fef5e719e0..88ca79be95 100644 --- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/DecompilerProvider.java +++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/DecompilerProvider.java @@ -725,11 +725,13 @@ public class DecompilerProvider extends NavigatableComponentProviderAdapter ViewerPosition myViewPosition = controller.getDecompilerPanel().getViewerPosition(); newProvider.doSetProgram(program); - // Any change in the HighlightTokens should be delivered to the new panel - DecompilerPanel myPanel = getDecompilerPanel(); - newProvider.setLocation(currentLocation, myPanel.getViewerPosition()); + // initialize the new provider's cache and then set the location + DecompileData myDecompileData = controller.getDecompileData(); + newProvider.controller.addToCache(myDecompileData); + newProvider.setLocation(currentLocation, myViewPosition); // transfer any state after the new decompiler is initialized + DecompilerPanel myPanel = getDecompilerPanel(); DecompilerPanel newPanel = newProvider.getDecompilerPanel(); newProvider.doWhenNotBusy(() -> { newPanel.setViewerPosition(myViewPosition);