GP-3697 Added delayed ProjectFileManager disposal in support of URL use

and opening linked project files and renamed ProjectFileData to
DefaultProjectData.
This commit is contained in:
ghidra1 2023-08-11 12:49:19 -04:00
parent 5ef4b269a1
commit 3eb642885c
51 changed files with 1636 additions and 813 deletions

View file

@ -29,26 +29,47 @@ import ghidra.util.Msg;
public class FindChangedFunctionsScript extends GhidraVersionTrackingScript {
private Program p1;
private Program p2;
@Override
public void cleanup(boolean success) {
if (p1 != null) {
p1.release(this);
}
if (p2 != null) {
p2.release(this);
}
super.cleanup(success);
}
@Override
protected void run() throws Exception {
Project project = state.getProject();
if (project == null) {
throw new RuntimeException("No project open");
}
// Prompt the user to load the two programs that will be analyzed.
// This will only allow you to select programs from the currently-open
// project in Ghidra, so import them if you haven't already.
Program p1 = askProgram("Program1_Version1");
Program p2 = askProgram("Program1_Version2");
p1 = askProgram("Program1_Version1");
if (p1 == null) {
return;
}
p2 = askProgram("Program1_Version2");
if (p2 == null) {
return;
}
// Make sure the selected programs are not open and locked by Ghidra. If so,
// warn the user.
if (areProgramsLocked(p1, p2)) {
Msg.showError(this, null, "Program is locked!", "One of the programs you selected is locked by Ghidra. Please correct and try again.");
Msg.showError(this, null, "Program is locked!",
"One of the programs you selected is locked by Ghidra. Please correct and try again.");
return;
}
}
// Create a new VT session
createVersionTrackingSession("new session", p1, p2);
@ -67,7 +88,7 @@ public class FindChangedFunctionsScript extends GhidraVersionTrackingScript {
println("Did not find exact match for: " + functionName);
}
}
/**
* Returns true if one of the programs is locked.
* <p>