diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-03-09 15:51:41 +0000 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2016-03-15 12:11:42 +0000 |
commit | 416843f69cf62d2f01e2a25f03bda0fdec949cb8 (patch) | |
tree | 8a0f86e1922e2de8998f3f016d24162954e78d65 | |
parent | 7b56d707440eec27c785368c65feb341048c4b5a (diff) |
Resolves: tdf#82781 avoid dereferencing invalid iterators
when using print preview with cursor on 2nd page which consists solely of
hidden text with show hiddle text enabled.
inner mrParentViewShell.Paint can invalidate iterators, as later
detected with the mbNewLayoutDuringPaint flag but we dereference
for the purposes of drawing the shadow before we get there.
easiest thing seems to be to just grab the bits of info we want before the
inner paint occurs.
(cherry picked from commit 4eb5f363ed9a3181a817f12d5ec49eede13b9c9c)
Change-Id: I09c9b06449db440b7beba7de9e71c239ee64f6ca
Reviewed-on: https://gerrit.libreoffice.org/23094
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
-rw-r--r-- | sw/source/core/view/pagepreviewlayout.cxx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx index 26ff858ce3ac..5e7f234b54c8 100644 --- a/sw/source/core/view/pagepreviewlayout.cxx +++ b/sw/source/core/view/pagepreviewlayout.cxx @@ -1090,7 +1090,9 @@ bool SwPagePreviewLayout::Paint(vcl::RenderContext& rRenderContext, const Rectan Rectangle aPxPaintRect = pOutputDev->LogicToPixel( aPageRect ); if ( aPxOutRect.IsOver( aPxPaintRect) ) { - if ( (*aPageIter)->pPage->IsEmptyPage() ) + const SwPageFrm* pPage = (*aPageIter)->pPage; + + if (pPage->IsEmptyPage()) { const Color aRetouche( mrParentViewShell.Imp()->GetRetoucheColor() ); if( pOutputDev->GetFillColor() != aRetouche ) @@ -1118,16 +1120,20 @@ bool SwPagePreviewLayout::Paint(vcl::RenderContext& rRenderContext, const Rectan } else { + const bool bIsLeftShadowed = pPage->IsLeftShadowNeeded(); + const bool bIsRightShadowed = pPage->IsRightShadowNeeded(); + mrParentViewShell.maVisArea = aPageRect; aPxPaintRect.Intersection( aPxOutRect ); Rectangle aPaintRect = pOutputDev->PixelToLogic( aPxPaintRect ); mrParentViewShell.Paint(rRenderContext, aPaintRect); + // --> OD 2007-08-15 #i80691# // paint page border and shadow { SwRect aPageBorderRect; SwPageFrm::GetBorderAndShadowBoundRect( SwRect( aPageRect ), &mrParentViewShell, &rRenderContext, aPageBorderRect, - (*aPageIter)->pPage->IsLeftShadowNeeded(), (*aPageIter)->pPage->IsRightShadowNeeded(), true ); + bIsLeftShadowed, bIsRightShadowed, true ); const vcl::Region aDLRegion(aPageBorderRect.SVRect()); mrParentViewShell.DLPrePaint2(aDLRegion); SwPageFrm::PaintBorderAndShadow( aPageRect, &mrParentViewShell, true, false, true ); @@ -1142,11 +1148,10 @@ bool SwPagePreviewLayout::Paint(vcl::RenderContext& rRenderContext, const Rectan break; } - if ( (*aPageIter)->pPage->GetPhyPageNum() == mnSelectedPageNum ) + if (pPage->GetPhyPageNum() == mnSelectedPageNum) { _PaintSelectMarkAtPage(rRenderContext, *aPageIter); } - } } |