Skip to content

Commit c0eb609

Browse files
authored
Fix LT-21729: Crash deleting phoneme features set (#322)
* Force new version for debugging purposes * Fix LT-21729: Crash deleting phoneme feature set
1 parent 44f3bfc commit c0eb609

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/SIL.LCModel/DomainImpl/OverridesLing_Lex.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7644,15 +7644,23 @@ protected override void RemoveObjectSideEffectsInternal(RemoveObjectEventArgs e)
76447644
if (removedCtxt != null)
76457645
{
76467646
var featConstrs = GetFeatureConstraintsExcept(removedCtxt);
7647-
foreach (var constr in removedCtxt.PlusConstrRS)
7647+
foreach (var constr in removedCtxt.PlusConstrRS.ToList())
76487648
{
76497649
if (!featConstrs.Contains(constr))
7650+
{
7651+
// Remove constr from removedCtxt first to avoid deleting removedCtxt twice (fixes LT-21729).
7652+
removedCtxt.PlusConstrRS.Remove(constr);
76507653
m_cache.LanguageProject.PhonologicalDataOA.FeatConstraintsOS.Remove(constr);
7654+
}
76517655
}
7652-
foreach (var constr in removedCtxt.MinusConstrRS)
7656+
foreach (var constr in removedCtxt.MinusConstrRS.ToList())
76537657
{
76547658
if (!featConstrs.Contains(constr))
7659+
{
7660+
// Remove constr from removedCtxt first to avoid deleting removedCtxt twice.
7661+
removedCtxt.MinusConstrRS.Remove(constr);
76557662
m_cache.LanguageProject.PhonologicalDataOA.FeatConstraintsOS.Remove(constr);
7663+
}
76567664
}
76577665
}
76587666
}

0 commit comments

Comments
 (0)