sw/source/uibase/utlui/glbltree.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
New commits: commit f817b3de1aa827d93e2a622735c4d570514f4849 Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Mon May 23 15:35:57 2022 -0800 Commit: Jim Raykowski <rayk...@gmail.com> CommitDate: Tue May 24 06:24:10 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> diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index 7e044f64ad65..38abd661566c 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) {