Skip to content

Commit 3bb0662

Browse files
jtmaxwell3jasonleenaylor
authored andcommitted
This fixes LT-22541
1 parent bbc3134 commit 3bb0662

2 files changed

Lines changed: 19 additions & 7 deletions

File tree

Src/LexText/Interlinear/SandboxBase.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,17 +1658,30 @@ private int CreateSecondaryAndCopyStrings(int flidChoices, int hvoMain, int flid
16581658

16591659
public void UpdateField(int hvo, int flid)
16601660
{
1661-
int hvoMorph = GetHvoMorphForLexSense(hvo);
1662-
if (hvoMorph != 0)
1661+
ICmObject hvoObject = Caches.MainCache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(hvo);
1662+
if (hvoObject is ILexSense lexSense)
16631663
{
1664-
ILexSense lexSense = Caches.MainCache.ServiceLocator.GetInstance<ILexSenseRepository>().GetObject(hvo);
1665-
ILexEntry lexEntry = lexSense?.Owner as ILexEntry;
1666-
if (lexSense != null && lexEntry != null)
1664+
int hvoMorph = GetHvoMorphForLexSense(hvo);
1665+
if (hvoMorph != 0 && lexSense.Owner is ILexEntry lexEntry)
16671666
{
16681667
// This fixes LT-22534.
16691668
EstablishDefaultSense(hvoMorph, lexEntry, lexSense, null);
16701669
}
1671-
1670+
}
1671+
if (hvoObject != null && hvoObject.Owner is IMoMorphSynAnalysis msa)
1672+
{
1673+
if (msa.Owner is ILexEntry lexEntry)
1674+
{
1675+
foreach (var sense in lexEntry.SensesOS)
1676+
{
1677+
int hvoMorph = GetHvoMorphForLexSense(sense.Hvo);
1678+
if (hvoMorph != 0 && sense.MorphoSyntaxAnalysisRA == msa)
1679+
{
1680+
// This fixes LT-22541.
1681+
EstablishDefaultSense(hvoMorph, lexEntry, sense, null);
1682+
}
1683+
}
1684+
}
16721685
}
16731686
}
16741687

Src/xWorks/PopupToolWindow.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using SIL.FieldWorks.Common.FwUtils;
21
using SIL.FieldWorks.Common.RootSites;
32
using SIL.LCModel;
43
using SIL.Utils;

0 commit comments

Comments
 (0)