GP-7092 - Fixed bug when deleting function with multiple function tags

This commit is contained in:
dragonmacher
2026-07-22 15:00:53 -04:00
parent 7ccc6e852b
commit c098bf9afa
4 changed files with 12 additions and 12 deletions

View File

@@ -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() {

View File

@@ -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;
} }

View File

@@ -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());
} }

View File

@@ -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();