mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +02:00
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:
parent
5ef4b269a1
commit
3eb642885c
51 changed files with 1636 additions and 813 deletions
|
@ -17,7 +17,6 @@
|
|||
// data and and then save the session.
|
||||
//@category Examples.Version Tracking
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import ghidra.app.script.GhidraScript;
|
||||
|
@ -32,6 +31,21 @@ import ghidra.program.model.listing.Program;
|
|||
import ghidra.util.task.TaskLauncher;
|
||||
|
||||
public class AutoVersionTrackingScript extends GhidraScript {
|
||||
|
||||
private Program sourceProgram;
|
||||
private Program destinationProgram;
|
||||
|
||||
@Override
|
||||
public void cleanup(boolean success) {
|
||||
if (sourceProgram != null && sourceProgram.isUsedBy(this)) {
|
||||
sourceProgram.release(this);
|
||||
}
|
||||
if (destinationProgram != null && destinationProgram.isUsedBy(this)) {
|
||||
destinationProgram.release(this);
|
||||
}
|
||||
super.cleanup(success);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
|
||||
|
@ -39,9 +53,6 @@ public class AutoVersionTrackingScript extends GhidraScript {
|
|||
askProjectFolder("Please choose a folder for your Version Tracking session.");
|
||||
String name = askString("Please enter a Version Tracking session name", "Session Name");
|
||||
|
||||
Program sourceProgram;
|
||||
Program destinationProgram;
|
||||
|
||||
boolean isCurrentProgramSourceProg = askYesNo("Current Program Source Program?",
|
||||
"Is the current program your source program?");
|
||||
|
||||
|
@ -54,6 +65,10 @@ public class AutoVersionTrackingScript extends GhidraScript {
|
|||
sourceProgram = askProgram("Please select the source (existing annotated) program");
|
||||
}
|
||||
|
||||
if (sourceProgram == null || destinationProgram == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Need to end the script transaction or it interferes with vt things that need locks
|
||||
end(true);
|
||||
|
||||
|
@ -81,9 +96,7 @@ public class AutoVersionTrackingScript extends GhidraScript {
|
|||
|
||||
public static <T extends Plugin> T getPlugin(PluginTool tool, Class<T> c) {
|
||||
List<Plugin> list = tool.getManagedPlugins();
|
||||
Iterator<Plugin> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
Plugin p = it.next();
|
||||
for (Plugin p : list) {
|
||||
if (p.getClass() == c) {
|
||||
return c.cast(p);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue