sw/source/uibase/utlui/content.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit d4ce88a36428231e65cc247967890496192e78cc
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Tue Feb 8 15:56:55 2022 -0900
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Tue Feb 15 03:18:25 2022 +0100

    SwNavigator: Check if document changed before calling HasContentChanged
    
    The HasContentChanged function is costly. This patch makes
    HasContentChanged only be called if the document change flag has not
    been cleared when the content tree gains focus.
    
    Change-Id: Iab051f6eea23d7bea91195214f6efdfcf5f24cc4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129700
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index ee88b6d3caa4..3a52f9d14e84 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3847,10 +3847,13 @@ IMPL_LINK_NOARG(SwContentTree, FocusInHdl, 
weld::Widget&, void)
 
         if (State::ACTIVE == m_eState && pActShell != GetWrtShell())
             SetActiveShell(pActShell);
+        // Only call HasContentChanged() if the document has changed since 
last called
         else if ((State::ACTIVE == m_eState || (State::CONSTANT == m_eState && 
pActShell == GetWrtShell())) &&
-                    HasContentChanged())
+                    m_bDocHasChanged)
         {
-            Display(true);
+            if (HasContentChanged())
+                Display(true);
+            m_bDocHasChanged = false;
         }
     }
     else if (State::ACTIVE == m_eState)

Reply via email to