diff --git a/Src/xWorks/FwXApp.cs b/Src/xWorks/FwXApp.cs index 6278bbc0e7..8c309ff654 100644 --- a/Src/xWorks/FwXApp.cs +++ b/Src/xWorks/FwXApp.cs @@ -58,20 +58,16 @@ public virtual string DefaultConfigurationPathname } /// - /// This is the one (and should be only) handler for the user Refresh command. - /// Refresh wants to first clean up the cache, then give things like Clerks a - /// chance to reload stuff (calling the old OnRefresh methods), then give - /// windows a chance to redisplay themselves. + /// Refresh all main windows. This method is almost an exact duplicate of + /// FwXWindow.OnMasterRefresh(), but differing since this class overrides + /// ActiveForm. (Possible merge them into a single method.) + /// This method is intentionally NOT named OnMasterRefresh(), to prevent it from + /// being called by the Mediator's reflection dispatch. (LT-22644) /// - public void OnMasterRefresh(object sender) + public void RefreshAllWindows() { - // TODO: This is no longer called by the PropertyTable, since this class - // is no longer an xcore colleague. But, it can't be removed either, - // since it is used by another method on this clsss. :-( CheckDisposed(); - // Susanna asked that refresh affect only the currently active project, which is - // what the string and List variables below attempt to handle. See LT-6444. FwXWindow activeWnd = ActiveForm as FwXWindow; List rgxw = new List(); diff --git a/Src/xWorks/FwXWindow.cs b/Src/xWorks/FwXWindow.cs index 8b67cdfdd7..e865feb7cf 100644 --- a/Src/xWorks/FwXWindow.cs +++ b/Src/xWorks/FwXWindow.cs @@ -101,25 +101,16 @@ public virtual void OnMasterRefresh(object sender) { CheckDisposed(); - // Susanna asked that refresh affect only the currently active project, which is - // what the string and List variables below attempt to handle. See LT-6444. FwXWindow activeWnd = ActiveForm as FwXWindow; - LcmCache activeCache = null; - if (activeWnd != null) - activeCache = activeWnd.Cache; - List rgxw = new List(); foreach (IFwMainWnd wnd in m_app.MainWindows) { FwXWindow xwnd = wnd as FwXWindow; if (xwnd != null) { - if (activeCache == null || xwnd.Cache == activeCache) - { - xwnd.PrepareToRefresh(); - rgxw.Add(xwnd); - } + xwnd.PrepareToRefresh(); + rgxw.Add(xwnd); } } if (activeWnd != null) @@ -1336,7 +1327,7 @@ private void OnWritingSystemListChanged(object sender, EventArgs eventArgs) // any writing systems are removed that a rootsite is currently displaying if (m_app is FwXApp) { - ((FwXApp)m_app).OnMasterRefresh(null); + ((FwXApp)m_app).RefreshAllWindows(); } ReversalIndexServices.CreateOrRemoveReversalIndexConfigurationFiles(m_app.Cache.ServiceLocator.WritingSystemManager, @@ -1350,7 +1341,7 @@ private void OnWritingSystemUpdated(object param, EventArgs args) { if (m_app is FwXApp) { - ((FwXApp)m_app).OnMasterRefresh(null); + ((FwXApp)m_app).RefreshAllWindows(); } } @@ -1675,9 +1666,9 @@ protected bool OnRedo(object args) } /// - /// Called in FwXApp.OnMasterRefresh BEFORE clearing the cache, typically to - /// save any work in progress. - /// REVIEW (Hasso) 2023.07: 2/3 production callers call this in a foreach loop in OnMasterRefresh. There has to be a more efficient way. + /// Called during a master refresh (OnMasterRefresh / FwXApp.RefreshAllWindows) + /// BEFORE clearing the cache, typically to save any work in progress. + /// REVIEW (Hasso) 2023.07: 2/3 production callers call this in a foreach loop. There has to be a more efficient way. /// public void PrepareToRefresh() { @@ -1690,7 +1681,8 @@ public void PrepareToRefresh() } /// - /// Called in FwXApp.OnMasterRefresh AFTER clearing the cache, to reset everything. + /// Called during a master refresh (OnMasterRefresh / FwXApp.RefreshAllWindows) + /// AFTER clearing the cache, to reset everything. /// /// public bool FinishRefresh() @@ -1880,7 +1872,7 @@ public bool ShowStylesDialog(string paraStyleName, string charStyleName, if (m_delegate.ShowStylesDialog(paraStyleName, charStyleName, setPropsToFactorySettings)) { // Need to refresh to reload the cache. See LT-6265. - (m_app as FwXApp).OnMasterRefresh(null); + (m_app as FwXApp).RefreshAllWindows(); // Refresh the fonts on popup windows. Publisher.Publish(new PublisherParameterObject(EventConstants.RefreshPopupWindowFonts, null, this));