Fix LT-21598: Crash deleting from Bulk Edit Entries#380
Open
mark-sil wants to merge 1 commit into
Open
Conversation
Bulk deleting lexical entries that participate in a lexical relation could crash with a NullReferenceException. With corrupt data (a lost incoming- reference index, not repaired by Find and Fix) a LexReference can still list a target that has already been deleted. During the deletion cascade, the LexReference removal side effects operated on those already-deleted objects and dereferenced their cleared cache. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
hahn-kev
reviewed
Jun 19, 2026
hahn-kev
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me, the tests reproduce the issue and fail without the fix.
One thing I did notice, that may effect something, is that the order in which UpdateMinimalLexReferences and UpdateLexEntryReferences is called has changed. The old version would call UpdateLex first, then UpdateMinimal however the new version changes that. I'm not sure if this was intentional but we might consider putting it back to how it was.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bulk deleting lexical entries that participate in a lexical relation could crash with a
NullReferenceException(LT-21598). The attached project (Puntipi-Luritja) has corrupt data — a lost incoming-reference index, not repaired by Find and Fix — so aLexReferencecan still list a target that has already been deleted. During the deletion cascade,LexReference's removal side effects operated on those already-deleted objects and dereferenced their cleared cache.Changes (
LexReferenceinOverridesLing_Lex.cs)UpdateMinimalLexReferencesskips targets that are no longer valid.RemoveObjectSideEffectsInternalonly updates the removed object's back-reference virtual properties (LexEntryReferences/LexSenseReferences/DateModified) while it is still valid; the remaining valid targets are still refreshed viaUpdateMinimalLexReferences.Testing
LingTests.cs, each verified to fail at the exact reported stack without its fix.🤖 Generated with Claude Code
This change is