Skip to content

Commit 67c0eff

Browse files
jtmaxwell3jasonleenaylor
authored andcommitted
Responding to Copilot's comments
1 parent 85fc19d commit 67c0eff

3 files changed

Lines changed: 16 additions & 6 deletions

File tree

Src/LexText/Interlinear/FocusBoxController.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ internal bool IsDirty
4747
get { return m_sandbox.IsDirty; }
4848
}
4949

50-
private bool suppressFocusChange = false;
50+
private bool m_suppressFocusChange = false;
5151

5252
// There is no logical reason for other buttons ever to get the focus. But .NET helpfully focuses the link words button
5353
// as we hide the focus box. And in some other circumstance, which I can't even figure out, it focuses the menu button.
@@ -265,7 +265,7 @@ internal void AdjustSizeAndLocationForControls(bool fAdjustOverallSize)
265265
}
266266
finally
267267
{
268-
if (!suppressFocusChange)
268+
if (!m_suppressFocusChange)
269269
{
270270
Focus();
271271
}
@@ -317,15 +317,20 @@ public virtual void SelectOccurrence(AnalysisOccurrence selected)
317317

318318
public void UpdateField(int hvo, int flid)
319319
{
320+
if (IsDisposed || m_sandbox == null)
321+
{
322+
return;
323+
}
324+
320325
try
321326
{
322327
// This fixes LT-22539.
323-
suppressFocusChange = true;
328+
m_suppressFocusChange = true;
324329
m_sandbox.UpdateField(hvo, flid);
325330
}
326331
finally
327332
{
328-
suppressFocusChange = false;
333+
m_suppressFocusChange = false;
329334
}
330335
}
331336

Src/LexText/Interlinear/InterlinDocForAnalysis.Designer.cs

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Src/LexText/Interlinear/SandboxBase.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,9 +1658,15 @@ private int CreateSecondaryAndCopyStrings(int flidChoices, int hvoMain, int flid
16581658

16591659
public void UpdateField(int hvo, int flid)
16601660
{
1661+
CheckDisposed();
1662+
if (!m_cache.ServiceLocator.IsValidObjectId(hvo))
1663+
{
1664+
return;
1665+
}
16611666
ICmObject hvoObject = Caches.MainCache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(hvo);
16621667
if (hvoObject is ILexSense lexSense && lexSense.Owner is ILexEntry lexEntry)
16631668
{
1669+
// This lex sense changed. Update morphs that use it.
16641670
foreach (int hvoMorph in GetHvoMorphsForLexSense(hvo))
16651671
{
16661672
// This fixes LT-22534.
@@ -1675,6 +1681,7 @@ public void UpdateField(int hvo, int flid)
16751681
{
16761682
if (sense.MorphoSyntaxAnalysisRA == msa)
16771683
{
1684+
// This lex sense changed. Update morphs that use it.
16781685
foreach (int hvoMorph in GetHvoMorphsForLexSense(sense.Hvo))
16791686
{
16801687
// This fixes LT-22541.

0 commit comments

Comments
 (0)