File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
src/SIL.LCModel/DomainImpl Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments