sw/source/uibase/utlui/glbltree.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit ad55cb3e5550ea92f2aee4bd424065436a900221
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Mon May 23 15:35:57 2022 -0800
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Wed Jun 1 19:10:11 2022 +0200

    tdf#149231 Fix crash on print preview of master
    
    caused by commit 1f9a792a391f0811bbb5f570ad5c84d13312c539.
    
    Change-Id: Iecfa019b04b84bb70b5e04af51f9f786d7cd9fdf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134846
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>
    (cherry picked from commit f817b3de1aa827d93e2a622735c4d570514f4849)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134788
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit ee67c82c210ec4bcac0a6e92a13dc63b06006239)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134907
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>
    Tested-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/sw/source/uibase/utlui/glbltree.cxx 
b/sw/source/uibase/utlui/glbltree.cxx
index d658a6db7271..45a03e537216 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -773,7 +773,8 @@ void 
SwGlobalTree::ExecuteContextMenuAction(std::string_view rSelectedPopupEntry
 
 IMPL_LINK_NOARG(SwGlobalTree, Timeout, Timer *, void)
 {
-    if (m_pActiveShell && m_pActiveShell->GetView().GetEditWin().HasFocus())
+    SwView* pView = GetParentWindow()->GetCreateView();
+    if (pView && pView->GetEditWin().HasFocus())
     {
         if (Update(false))
             Display();
@@ -877,14 +878,13 @@ bool SwGlobalTree::Update(bool bHard)
     bool bRet = false;
     if (pActView && pActView->GetWrtShellPtr())
     {
-        SwWrtShell* pOldShell = m_pActiveShell;
+        const SwWrtShell* pOldShell = m_pActiveShell;
         m_pActiveShell = pActView->GetWrtShellPtr();
         if(m_pActiveShell != pOldShell)
         {
-            if (pOldShell)
-                EndListening(*pOldShell->GetView().GetDocShell());
-            StartListening(*m_pActiveShell->GetView().GetDocShell());
             m_pSwGlblDocContents.reset();
+            if (!IsListening(*m_pActiveShell->GetView().GetDocShell()))
+                StartListening(*m_pActiveShell->GetView().GetDocShell());
         }
         if(!m_pSwGlblDocContents)
         {

Reply via email to