Skip to content

Commit 2947f58

Browse files
authored
Fix LT-22295: Crash when switching to Texts and Words (#739)
* Fix LT-22295: Crash when switching to Texts and Words * Respond to Hasso's comments
1 parent 8c4febb commit 2947f58

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

Src/LexText/Interlinear/InterlinDocForAnalysis.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,18 @@ public virtual void TriggerAnalysisSelected(AnalysisOccurrence target, bool fSav
310310
RecordGuessIfNotKnown(target);
311311
InstallFocusBox();
312312
RootBox.DestroySelection();
313-
FocusBox.SelectOccurrence(target);
314-
SetFocusBoxSizeForVc();
313+
try
314+
{
315+
// Suppress changing the FocusBox when called from VwDrawRootBufferedClass.Create()
316+
// when the selected word has a different RTL from the text (LT-22295).
317+
SuppressChanges = true;
318+
FocusBox.SelectOccurrence(target);
319+
SetFocusBoxSizeForVc();
320+
}
321+
finally
322+
{
323+
SuppressChanges = false;
324+
}
315325
SelectedOccurrence = target;
316326

317327
if (fShow)
@@ -1851,7 +1861,7 @@ internal FocusBoxController FocusBox
18511861
{
18521862
get
18531863
{
1854-
if ((ExistingFocusBox == null && ForEditing) || hasRightToLeftChanged)
1864+
if ((ExistingFocusBox == null && ForEditing) || hasRightToLeftChanged && !SuppressChanges)
18551865
{
18561866
CreateFocusBox();
18571867
previousRightToLeft = Vc.RightToLeft;
@@ -1991,6 +2001,8 @@ public override bool WantInitialSelection
19912001
get { return false; }
19922002
}
19932003

2004+
private bool SuppressChanges = false;
2005+
19942006
protected override void OnMouseDown(MouseEventArgs e)
19952007
{
19962008
// The base method does this too, but some paths in this method don't go through the base!

0 commit comments

Comments
 (0)