diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2019-06-19 15:03:27 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-06-26 09:55:27 +0200 |
commit | bc95445e08e07a5d23e2c833b47a31ba0a217517 (patch) | |
tree | 5e7da5d5d62f72480c4aea6f5c29c2f4df257221 | |
parent | 961f487b0ad6160b45bd688078a09b40c9345444 (diff) |
tdf#125754 sw_redlinehide: avoid recursive layout in SetHideRedlines()
During SwLayHelper::CheckInsertPage(), SwRootFrame::CheckViewLayout() is
called, which may change the size of the view, which causes a
StartAction()/EndAction(), therefore layouting the frames existing at
that point, which moves some content onto the newly created frame, but
CheckInsertPage() expects to find only SwLayoutFrames on it and crashes.
40 SwLayAction::InternalAction(OutputDevice*) (this=0x7fffd2333f00) at sw/source/core/layout/layact.cxx:551
41 SwLayAction::Action(OutputDevice*) (this=0x7fffd2333f00) at sw/source/core/layout/layact.cxx:348
42 SwViewShell::ImplEndAction(bool) (this=0x56eaff0, bIdleEnd=false) at sw/source/core/view/viewsh.cxx:295
43 SwViewShell::EndAction(bool) (this=0x56eaff0, bIdleEnd=false) at sw/inc/viewsh.hxx:600
44 SwCursorShell::EndAction(bool, bool) (this=0x56eaff0, bIdleEnd=false, DoSetPosX=false) at sw/source/core/crsr/crsrsh.cxx:254
45 SwView::OuterResizePixel(Point const&, Size const&) (this=0x5589850, rOfst=Point = {...}, rSize=Size = {...}) at sw/source/uibase/uiview/viewport.cxx:1125
46 SwView::DocSzChgd(Size const&) (this=0x5589850, rSz=Size = {...}) at sw/source/uibase/uiview/viewport.cxx:203
47 SizeNotify(SwViewShell const*, Size const&) (pVwSh=0x56eaff0, rSize=Size = {...}) at sw/source/uibase/docvw/edtwin3.cxx:67
48 SwViewShell::SizeChgNotify() (this=0x56eaff0) at sw/source/core/view/viewsh.cxx:1077
49 AdjustSizeChgNotify(SwRootFrame*) (pRoot=0x56ea6c0) at sw/source/core/layout/pagechg.cxx:824
50 SwRootFrame::CheckViewLayout(SwViewOption const*, SwRect const*) (this=0x56ea6c0, pViewOpt=0x0, pVisArea=0x0) at sw/source/core/layout/pagechg.cxx:2377
51 SwPageFrame::Paste(SwFrame*, SwFrame*) (this=0x66aa500, pParent=0x56ea6c0, pSibling=0x0) at sw/source/core/layout/pagechg.cxx:941
52 InsertNewPage(SwPageDesc&, SwFrame*, bool, bool, bool, bool, SwFrame*) (rDesc=..., pUpper=0x56ea6c0, bOdd=true, bFirst=false, bInsertEmpty=false, bFootnote=false, pSibling=0x0) at sw/source/core/layout/frmtool.cxx:2853
53 SwLayHelper::CheckInsertPage() (this=0x60a9170) at sw/source/core/layout/laycache.cxx:680
54 SwLayHelper::CheckInsert(unsigned long) (this=0x60a9170, nNodeIndex=1699) at sw/source/core/layout/laycache.cxx:890
55 InsertCnt_(SwLayoutFrame*, SwDoc*, unsigned long, bool, unsigned long, SwFrame*) (pLay=0x6f20f60, pDoc=0x54c86a0, nIndex=1698, bPages=true, nEndIndex=2627, pPrv=0x6ef2d20) at sw/source/core/layout/frmtool.cxx:1503
56 MakeFrames(SwDoc*, SwNodeIndex const&, SwNodeIndex const&) (pDoc=0x54c86a0, rSttIdx=SwNodeIndex (node 1588), rEndIdx=SwNodeIndex (node 2627)) at sw/source/core/layout/frmtool.cxx:1910
57 UnHideRedlines(SwRootFrame&, SwNodes&, SwNode const&, std::__debug::set<unsigned long, std::less<unsigned long>, std::allocator<unsigned long> >*) (rLayout=..., rNodes=..., rEndOfSectionNode=..., pSkipped=0x0) at sw/source/core/layout/wsfrm.cxx:4445
58 SwRootFrame::SetHideRedlines(bool) (this=0x56ea6c0, bHideRedlines=false) at sw/source/core/layout/wsfrm.cxx:4539
59 SwView::Execute(SfxRequest&) (this=0x5589850, rReq=...) at sw/source/uibase/uiview/view2.cxx:658
To avoid that, do StartAction()/EndAction() in the UI caller of
SwRootFrame::SetHideRedlines() already; the other callers in
Undo/DocumentRedlineManager should already be covered by Actions.
Change-Id: I366140415d5714d386af3cf9db30e39b12ade2ce
Reviewed-on: https://gerrit.libreoffice.org/74369
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
(cherry picked from commit dd489bc01adc22fc5015ea56b61d66104af184a8)
Reviewed-on: https://gerrit.libreoffice.org/74431
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 83263c0428410bd8aa2344aa83e0388fdd3f7342)
Reviewed-on: https://gerrit.libreoffice.org/74508
Tested-by: Xisco Faulí <xiscofauli@libreoffice.org>
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r-- | sw/source/core/layout/wsfrm.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index a5a589bae4a0..7f1c58461858 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -4483,6 +4483,7 @@ void SwRootFrame::SetHideRedlines(bool const bHideRedlines) return; } mbHideRedlines = bHideRedlines; + assert(GetCurrShell()->ActionPend()); // tdf#125754 avoid recursive layout SwDoc & rDoc(*GetFormat()->GetDoc()); // don't do early return if there are no redlines: // Show->Hide must init hidden number trees diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index d4dcbe5473fb..f3eb5fd62a4a 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -638,8 +638,12 @@ void SwView::Execute(SfxRequest &rReq) if( static_cast<const SfxBoolItem*>(pItem)->GetValue() ) nMode |= RedlineFlags::ShowDelete; + // tdf#125754 avoid recursive layout + // because all views share the layout, have to use AllAction + m_pWrtShell->StartAllAction(); m_pWrtShell->GetLayout()->SetHideRedlines( !static_cast<const SfxBoolItem*>(pItem)->GetValue()); + m_pWrtShell->EndAllAction(); if (m_pWrtShell->IsRedlineOn()) m_pWrtShell->SetInsMode(); } |