Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Src/LexText/Interlinear/InterlinearTextsRecordClerk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,6 @@ public override void PropChanged(int hvo, int tag, int ivMin, int cvIns, int cvD
{
m_langProjectTextsFlid = Cache.MetaDataCacheAccessor.GetFieldId("LangProject", "Texts", true);
}
if (tag == m_langProjectTextsFlid && (cvIns > 0 || cvDel > 0))
{
InterestingTextsDecorator.ClearInterestingTextsList(m_propertyTable);
}
}

internal abstract class CreateAndInsertStText : RecordList.ICreateAndInsert<IStText>
Expand Down
31 changes: 21 additions & 10 deletions Src/xWorks/ConcDecorator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using SIL.FieldWorks.Common.Controls;
using SIL.FieldWorks.Common.FwUtils;
using static SIL.FieldWorks.Common.FwUtils.FwUtils;
using SIL.LCModel;
using SIL.LCModel.Application;
using SIL.LCModel.Core.Cellar;
Expand All @@ -18,6 +17,7 @@
using System.Linq;
using System.Xml;
using XCore;
using static SIL.FieldWorks.Common.FwUtils.FwUtils;

namespace SIL.FieldWorks.XWorks
{
Expand Down Expand Up @@ -98,6 +98,10 @@ public override void RemoveNotification(IVwNotifyChange nchng)
// If a clerk were to be disposed some other time when another clerk was still using the ITL,
// this would be a bad thing to do.
base.RemoveNotification(m_interestingTexts);
// Clear the cache in case we are not shutting down the main window.
// This avoids problems in LT-22508 caused by stale cache data.
InterestingTextsDecorator.ClearInterestingTextsList(PropTable);
m_interestingTexts = null;
}
}

Expand All @@ -124,7 +128,7 @@ private int[] GetAnalysisOccurrences(int hvo)

public IEnumerable<IStText> InterestingTexts
{
get { return m_interestingTexts.InterestingTexts; }
get { return InterestingTextsList.InterestingTexts; }
}

public override void PropChanged(int hvo, int tag, int ivMin, int cvIns, int cvDel)
Expand Down Expand Up @@ -315,10 +319,8 @@ int[] GetSenseOccurrences(int hvo)

private bool BelongsToInterestingText(ISegment seg)
{
if (m_interestingTexts == null)
return true; // no filtering
IStText text = seg.Paragraph != null ? seg.Paragraph.Owner as IStText : null;
return (text != null && m_interestingTexts.IsInterestingText(text));
return (text != null && InterestingTextsList.IsInterestingText(text));

}

Expand All @@ -327,9 +329,7 @@ private bool BelongsToInterestingText(ISegment seg)
/// </summary>
public bool IsInterestingText(IStText text)
{
if (m_interestingTexts == null)
return true;
return m_interestingTexts.IsInterestingText(text);
return InterestingTextsList.IsInterestingText(text);
}

public override int[] VecProp(int hvo, int tag)
Expand Down Expand Up @@ -552,8 +552,19 @@ public void SetMediator(Mediator mediator, PropertyTable propertyTable)
{
Mediator = mediator;
PropTable = propertyTable;
m_interestingTexts = InterestingTextsDecorator.GetInterestingTextList(mediator, PropTable, m_services);
m_interestingTexts.InterestingTextsChanged += m_interestingTexts_InterestingTextsChanged;
}

private InterestingTextList InterestingTextsList
{
get
{
if (m_interestingTexts == null)
{
m_interestingTexts = InterestingTextsDecorator.GetInterestingTextList(Mediator, PropTable, m_services);
m_interestingTexts.InterestingTextsChanged += m_interestingTexts_InterestingTextsChanged;
}
return m_interestingTexts;
}
}

void m_interestingTexts_InterestingTextsChanged(object sender, InterestingTextsChangedArgs e)
Expand Down
Loading