Skip to content

Ghidra is a software reverse engineering (SRE) framework

Test fixes

dragonmacherb6f22a939fb2
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/features/base/codecompare/panel/FunctionComparisonPanel.java b/Ghidra/Features/Base/src/main/java/ghidra/features/base/codecompare/panel/FunctionComparisonPanel.java
index 304a5db2bd..e6e326bd94 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/features/base/codecompare/panel/FunctionComparisonPanel.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/features/base/codecompare/panel/FunctionComparisonPanel.java
@@ -66,7 +66,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
private static final String DUAL_SCROLLING_HELP_TOPIC = "FunctionComparison";
private JTabbedPane tabbedPane;
- private Map<String, JComponent> tabComponentsByName;
+ private Map<String, CodeComparisonView> tabComponentsByName;
private List<CodeComparisonView> codeComparisonViews;
private ToggleScrollLockAction toggleScrollLockAction;
private boolean syncScrolling = false;
@@ -89,6 +89,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
codeComparisonViews = getCodeComparisonViews(tool, owner);
tabComponentsByName = new HashMap<>();
+
createMainPanel();
createActions(owner);
setScrollingSyncState(true);
@@ -96,6 +97,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
// reload saved state; add the listener after we are fully finished build so we do not save
// any default state
readPanelState();
+
tabbedPane.addChangeListener(this);
HelpService help = Help.getHelpService();
@@ -243,14 +245,14 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
* @return true if the named view was found in the view map
*/
public boolean setActiveView(String name) {
- JComponent component = tabComponentsByName.get(name);
- if (component != null) {
- if (tabbedPane.getSelectedComponent() == component) {
+ CodeComparisonView view = tabComponentsByName.get(name);
+ if (view != null) {
+ if (tabbedPane.getSelectedComponent() == view) {
tabChanged();
}
- tabbedPane.setSelectedComponent(component);
+ tabbedPane.setSelectedComponent(view);
}
- return component != null;
+ return view != null;
}
/**
diff --git a/Ghidra/Features/CodeCompare/src/main/java/ghidra/features/codecompare/decompile/DecompilerCodeComparisonView.java b/Ghidra/Features/CodeCompare/src/main/java/ghidra/features/codecompare/decompile/DecompilerCodeComparisonView.java
index 6848537d54..b41262e1c9 100644
--- a/Ghidra/Features/CodeCompare/src/main/java/ghidra/features/codecompare/decompile/DecompilerCodeComparisonView.java
+++ b/Ghidra/Features/CodeCompare/src/main/java/ghidra/features/codecompare/decompile/DecompilerCodeComparisonView.java
@@ -98,7 +98,7 @@ public class DecompilerCodeComparisonView extends CodeComparisonView {
maybeLoadFunction(LEFT, comparisonData.get(LEFT).getFunction());
maybeLoadFunction(RIGHT, comparisonData.get(RIGHT).getFunction());
if (coordinator != null) {
- coordinator.leftLocationChanged((ProgramLocation) null);
+ coordinator.leftLocationChanged(null);
}
}
diff --git a/Ghidra/Features/CodeCompare/src/test/java/ghidra/features/codecompare/decompile/DualDecompilerActionTest.java b/Ghidra/Features/CodeCompare/src/test/java/ghidra/features/codecompare/decompile/DualDecompilerActionTest.java
index bb11cda724..829937c854 100644
--- a/Ghidra/Features/CodeCompare/src/test/java/ghidra/features/codecompare/decompile/DualDecompilerActionTest.java
+++ b/Ghidra/Features/CodeCompare/src/test/java/ghidra/features/codecompare/decompile/DualDecompilerActionTest.java
@@ -756,9 +756,10 @@ public class DualDecompilerActionTest extends AbstractDualDecompilerTest {
provider = compareFunctions(Set.of(leftFunc, rightFunc));
DecompilerCodeComparisonView decompPanel = findDecompilerPanel(provider);
- waitForDecompile(decompPanel);
- decompPanel.setSynchronizedScrolling(true);
+ runSwing(() -> decompPanel.setSynchronizedScrolling(true));
+
setActivePanel(provider, decompPanel);
+ waitForDecompile(decompPanel);
assertEquals(decompPanel.getFunction(Side.LEFT), leftFunc);
assertEquals(decompPanel.getFunction(Side.RIGHT), rightFunc);
diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompileRunnable.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompileRunnable.java
index 51c6189e86..1b0abd813a 100644
--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompileRunnable.java
+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompileRunnable.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,6 +43,8 @@ class DecompileRunnable implements SwingRunnable {
* @param program the program containing the function to be decompiled
* @param location the location for which to find its containing function.
* @param debugFile if non-null, the file to store decompile debug information.
+ * @param viewerPosition the viewer's position
+ * @param decompilerManager the decompile manager
*/
public DecompileRunnable(Program program, ProgramLocation location, File debugFile,
ViewerPosition viewerPosition, DecompilerManager decompilerManager) {