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.
|
* This is a regression test. Make sure function deletes work with multiple tags.
|
||||||
* See issue #9386.
|
* See github issue #9386.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteFunctionWithMultipleTags() {
|
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
|
// 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
|
// those cases the validity check will fail and we'll be forced to go back to
|
||||||
// the db.
|
// the db.
|
||||||
|
Set<FunctionTag> copy = new HashSet<>();
|
||||||
try (Closeable c = lock.read()) {
|
try (Closeable c = lock.read()) {
|
||||||
|
|
||||||
if (refreshIfNeeded() && tags != null) {
|
if (!refreshIfNeeded() || tags == null) {
|
||||||
return tags;
|
FunctionTagManagerDB tagManager =
|
||||||
|
(FunctionTagManagerDB) manager.getFunctionTagManager();
|
||||||
|
tags = tagManager.getFunctionTagsByFunctionID(getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a list of all tag records that map to our function.
|
copy.addAll(tags);
|
||||||
FunctionTagManagerDB tagManager =
|
|
||||||
(FunctionTagManagerDB) manager.getFunctionTagManager();
|
|
||||||
tags = tagManager.getFunctionTagsByFunctionID(getID());
|
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
manager.dbError(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
|
// Remove all tag mappings associated with this function
|
||||||
for (FunctionTag tag : new ArrayList<>(function.getTags())) {
|
for (FunctionTag tag : function.getTags()) {
|
||||||
function.removeTag(tag.getName());
|
function.removeTag(tag.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ public interface Function extends Namespace {
|
|||||||
/**
|
/**
|
||||||
* Return all {@link FunctionTag} objects associated with this function.
|
* Return all {@link FunctionTag} objects associated with this function.
|
||||||
*
|
*
|
||||||
* @return set of tag names
|
* @return set of tags
|
||||||
*/
|
*/
|
||||||
public Set<FunctionTag> getTags();
|
public Set<FunctionTag> getTags();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user