[Libreoffice-commits] core.git: sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jun 20 09:20:22 UTC 2019
sw/source/core/layout/wsfrm.cxx | 1 +
sw/source/uibase/uiview/view2.cxx | 4 ++++
2 files changed, 5 insertions(+)
New commits:
commit dd489bc01adc22fc5015ea56b61d66104af184a8
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Jun 19 15:03:27 2019 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Jun 20 11:19:16 2019 +0200
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 at cib.de>
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index c5854a9d2bde..cfd0e4ff5024 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -4499,6 +4499,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 1fcb92016045..6c045bc76b9a 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -655,8 +655,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();
}
More information about the Libreoffice-commits
mailing list