diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-05-21 16:15:16 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-05-21 16:26:33 +0100 |
commit | bbfa7a65cf6c92326b9e54bf1ff6019b4fb65f67 (patch) | |
tree | 64b748957018a67209d80aaf35309a069b1c04a0 /sd | |
parent | 7aed3a008967a817ff3d58fb4bdf1c417fdbe8c0 (diff) |
crash because iterator position wasn't changed in stl conversion
regression from e0284f4bba59912e1c49cb36936e041e891a5833
Here's the original code using the pre stl iterators.
if( !pPara && nDepth > 0 && rSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON &&
pOutliner->GetDepth( (sal_uInt16) pOutliner->GetAbsPos( (Paragraph*) pList->First() ) ) > 0 )
pPara = pOutliner->GetParagraph( 0 ); // Put NumBulletItem in outline level 1
Hidden in there is a pList->First() which only gets called if the prior
conditions are true. pList->First() resets the index of the internal pList
iterator position of pList to 0 i.e. the next call to pList->Prev will now return 0.
The equivalent in the post-stl-conversion code is to jump the reverse_iterator
iter to the last position in the reverse view.
Create a level 10 entry in master view, select level 10, and use the bullets
and numbering dropdown from the side panel to see this crash
Change-Id: I52c22ea52020feb0fb75924f63ebe225be462071
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/view/drawview.cxx | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx index 18a181f525d5..54208aa8cb00 100644 --- a/sd/source/ui/view/drawview.cxx +++ b/sd/source/ui/view/drawview.cxx @@ -236,9 +236,18 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet, ++iter; pPara = iter != aSelList.rend() ? *iter : NULL; - if( !pPara && nDepth > 0 && rSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON && - pOutliner->GetDepth( pOutliner->GetAbsPos(*(aSelList.begin())) ) > 0 ) - pPara = pOutliner->GetParagraph( 0 ); // Put NumBulletItem in outline level 1 + bool bJumpToLevel1 = false; + if( !pPara && nDepth > 0 && rSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON ) + bJumpToLevel1 = true; + + if (bJumpToLevel1) + { + iter = aSelList.rend(); + --iter; + + if (pOutliner->GetDepth(pOutliner->GetAbsPos(*iter)) > 0) + pPara = pOutliner->GetParagraph( 0 ); // Put NumBulletItem in outline level 1 + } } mpDocSh->SetWaitCursor( false ); |