From e619d8ab723a3e1dea5c5e60406ad24d907cd0a7 Mon Sep 17 00:00:00 2001 From: dragonmacher <48328597+dragonmacher@users.noreply.github.com> Date: Mon, 8 Mar 2021 12:32:19 -0500 Subject: [PATCH] GP-757 - Function Graph - fixed bug that colored the entire vertex when only the entry point had a color applied Closes #1080 --- .../core/functiongraph/ToolBasedColorProvider.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/ToolBasedColorProvider.java b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/ToolBasedColorProvider.java index c4e9012afc..f5ba5c8d0b 100644 --- a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/ToolBasedColorProvider.java +++ b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/ToolBasedColorProvider.java @@ -22,6 +22,7 @@ import ghidra.app.plugin.core.colorizer.ColorizingService; import ghidra.app.plugin.core.functiongraph.graph.vertex.FGVertex; import ghidra.app.plugin.core.functiongraph.mvc.FunctionGraphVertexAttributes; import ghidra.framework.options.SaveState; +import ghidra.program.model.address.AddressSetView; import ghidra.program.model.listing.Program; class ToolBasedColorProvider implements FGColorProvider { @@ -102,6 +103,15 @@ class ToolBasedColorProvider implements FGColorProvider { // The loading/saving of colors is handled automatically by the service, but this is // for the background of the code units stored in the DB. We still have to let this // vertex know that it has a custom background. + + AddressSetView addresses = vertex.getAddresses(); + AddressSetView allColorAddress = service.getAllBackgroundColorAddresses(); + if (!allColorAddress.contains(addresses)) { + // sparse colors for the addresses of this node; assume this has not been colored + // from the function graph, but from the service for individual addresses. + return; + } + Color savedColor = service.getBackgroundColor(vertex.getVertexAddress()); if (savedColor != null) { vertex.restoreColor(savedColor);