From 6e0bb3fc4e89ddb85ddf40889b11a0c0bd4ab607 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 28 Aug 2020 12:00:11 +0300 Subject: Fix ooo38104-1.sxw crash after c123bfff501229f398a1b679fc7434b82d53685c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unlike the c123bf commit, this commit does not cause the crash that was caught by the crash-testing system. (The crash could be reproduced by: wget -O ooo38104-1.sxw https://bz.apache.org/ooo/attachment.cgi?id=19889 ./instdir/program/soffice.bin --headless --convert-to docx ./ooo38104-1.sxw ) In this commit, I reinstate the "early return" in SwView::ReadUserDataSequence() that I dropped in the c123bf commit, but instead move the SelectShell() call earlier, so that it will be executed before the potential early return. The problem that we try to fix here is the one that the fresh CppunitTest_sw_updateall_object_replacements checks, so to reproduce that problem, revert both this commit and c123bf, and then run that unit test. Change-Id: I6c728b75a2f172b75fbf2ad00c019c32aecc19f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101531 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sw/source/uibase/uiview/view.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sw') diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 32c64fef35a4..a61a96af71d6 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -1381,10 +1381,16 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue > // delegate further GetViewImpl()->GetUNOObject_Impl()->getViewSettings()->setPropertyValue("ShowOnlineLayout", uno::Any(bBrowseMode)); } + + SelectShell(); + if (!bGotVisibleBottom) return; Point aCursorPos( nX, nY ); + const long nAdd = m_pWrtShell->GetViewOptions()->getBrowseMode() ? DOCUMENTBORDER : DOCUMENTBORDER*2; + if (nBottom > (m_pWrtShell->GetDocSize().Height()+nAdd) ) + return; m_pWrtShell->EnableSmooth( false ); const tools::Rectangle aVis( nLeft, nTop, nRight, nBottom ); @@ -1441,7 +1447,6 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue > // reset flag value m_pWrtShell->SetMacroExecAllowed( bSavedFlagValue ); } - SelectShell(); // Set ViewLayoutSettings const bool bSetViewLayoutSettings = bGotViewLayoutColumns && bGotViewLayoutBookMode && -- cgit