From 481a1bfe1576fbec5a7726e4624aa002af3ed149 Mon Sep 17 00:00:00 2001 From: John Maxwell Date: Fri, 30 Jan 2026 10:48:30 -0800 Subject: [PATCH] Fix LT-22390: Crash when clicking Apply button in Bulk Edit --- Src/FdoUi/PhonologicalFeatureEditor.cs | 39 ++++++++++++++++---------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/Src/FdoUi/PhonologicalFeatureEditor.cs b/Src/FdoUi/PhonologicalFeatureEditor.cs index 85e95a4948..bc0048d24d 100644 --- a/Src/FdoUi/PhonologicalFeatureEditor.cs +++ b/Src/FdoUi/PhonologicalFeatureEditor.cs @@ -260,25 +260,30 @@ private void m_tree_TreeLoad(object sender, EventArgs e) { if (m_PhonologicalFeatureTreeManager == null) { - if (!String.IsNullOrEmpty(m_featDefnAbbr)) - { - // Find the feature definition this editor was created to choose options from - var featDefns = from s in m_cache.LangProject.PhFeatureSystemOA.FeaturesOC - where s.Abbreviation.BestAnalysisAlternative.Text == m_featDefnAbbr - select s; - if (featDefns.Any()) - m_closedFeature = featDefns.First() as IFsClosedFeature; - } - - m_PhonologicalFeatureTreeManager = new PhonologicalFeaturePopupTreeManager(m_tree, - m_cache, false, m_mediator, PropTable, - PropTable.GetValue
("window"), - m_displayWs, m_closedFeature); - m_PhonologicalFeatureTreeManager.AfterSelect += new TreeViewEventHandler(m_PhonFeaturePopupTreeManager_AfterSelect); + CreatePhonologicalFeatureTreeManager(); } m_PhonologicalFeatureTreeManager.LoadPopupTree(0); } + private void CreatePhonologicalFeatureTreeManager() + { + if (!String.IsNullOrEmpty(m_featDefnAbbr)) + { + // Find the feature definition this editor was created to choose options from + var featDefns = from s in m_cache.LangProject.PhFeatureSystemOA.FeaturesOC + where s.Abbreviation.BestAnalysisAlternative.Text == m_featDefnAbbr + select s; + if (featDefns.Any()) + m_closedFeature = featDefns.First() as IFsClosedFeature; + } + + m_PhonologicalFeatureTreeManager = new PhonologicalFeaturePopupTreeManager(m_tree, + m_cache, false, m_mediator, PropTable, + PropTable.GetValue("window"), + m_displayWs, m_closedFeature); + m_PhonologicalFeatureTreeManager.AfterSelect += new TreeViewEventHandler(m_PhonFeaturePopupTreeManager_AfterSelect); + } + private void m_PhonFeaturePopupTreeManager_AfterSelect(object sender, TreeViewEventArgs e) { // Arrange to turn all relevant items blue. @@ -422,6 +427,10 @@ private IFsFeatStruc GetTargetFsFeatStruc() else if (obj is IFsSymFeatVal) { IFsSymFeatVal closedValue = (IFsSymFeatVal) obj; + if (m_PhonologicalFeatureTreeManager == null) + { + CreatePhonologicalFeatureTreeManager(); + } fsTarget = m_PhonologicalFeatureTreeManager.CreateEmptyFeatureStructureInAnnotation(obj); var fsClosedValue = Cache.ServiceLocator.GetInstance().Create(); fsTarget.FeatureSpecsOC.Add(fsClosedValue);