mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-07-30 07:18:37 -09:00
GP-7092 - Fixed bug when deleting function with multiple function tags
This commit is contained in:
@@ -117,7 +117,7 @@ public class DeleteFunctionCmdTest extends AbstractGenericTest {
|
||||
|
||||
/*
|
||||
* This is a regression test. Make sure function deletes work with multiple tags.
|
||||
* See issue #9386.
|
||||
* See github issue #9386.
|
||||
*/
|
||||
@Test
|
||||
public void testDeleteFunctionWithMultipleTags() {
|
||||
|
||||
@@ -1528,21 +1528,21 @@ public class FunctionDB extends DbObject implements Function {
|
||||
// cache will have the current tag state unless tags have been deleted or edited; in
|
||||
// those cases the validity check will fail and we'll be forced to go back to
|
||||
// the db.
|
||||
Set<FunctionTag> copy = new HashSet<>();
|
||||
try (Closeable c = lock.read()) {
|
||||
|
||||
if (refreshIfNeeded() && tags != null) {
|
||||
return tags;
|
||||
}
|
||||
|
||||
// Get a list of all tag records that map to our function.
|
||||
if (!refreshIfNeeded() || tags == null) {
|
||||
FunctionTagManagerDB tagManager =
|
||||
(FunctionTagManagerDB) manager.getFunctionTagManager();
|
||||
tags = tagManager.getFunctionTagsByFunctionID(getID());
|
||||
}
|
||||
|
||||
copy.addAll(tags);
|
||||
}
|
||||
catch (IOException e) {
|
||||
manager.dbError(e);
|
||||
}
|
||||
return tags;
|
||||
return copy;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -430,7 +430,7 @@ public class FunctionManagerDB implements FunctionManager {
|
||||
}
|
||||
|
||||
// Remove all tag mappings associated with this function
|
||||
for (FunctionTag tag : new ArrayList<>(function.getTags())) {
|
||||
for (FunctionTag tag : function.getTags()) {
|
||||
function.removeTag(tag.getName());
|
||||
}
|
||||
|
||||
|
||||
@@ -283,7 +283,7 @@ public interface Function extends Namespace {
|
||||
/**
|
||||
* Return all {@link FunctionTag} objects associated with this function.
|
||||
*
|
||||
* @return set of tag names
|
||||
* @return set of tags
|
||||
*/
|
||||
public Set<FunctionTag> getTags();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user