summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-09-19 20:47:48 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-09-20 08:36:56 +0000
commit6bcbf68b29b609cf06dbea0e192533e11eb523c3 (patch)
tree87cf680ee17ac702410a5d764ec702a533f27d35 /sw
parent6779927cfcfbd386c8d9129ac49385cd54af6739 (diff)
rhbz#689053: fix crash following delete at last table cell:
The IsSelOvr() in SwCrsrShell::Combine() detects that the PaM with mark in the last table cell and point ouside the table is invalid, but unfortunatley restores the wrong position, which does not actually correct the PaM; the deletion on the invalid PaM then removes the last SwTxtNode in the document, which leads to crash later. (cherry picked from commit af4b6c94c68b5f67b931cde8d0acda6ec8b288bb) Conflicts: sw/source/core/crsr/crsrsh.cxx Change-Id: Ib2ae0b54e6c15dbe5b6811d8696531bf2022e1a4 Reviewed-on: https://gerrit.libreoffice.org/652 Reviewed-by: Miklos Vajna <vmiklos@suse.cz> Tested-by: Miklos Vajna <vmiklos@suse.cz>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/crsr/crsrsh.cxx15
1 files changed, 8 insertions, 7 deletions
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index ca62c557e9f5..1493d14cd180 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2012,26 +2012,27 @@ void SwCrsrShell::Combine()
return;
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
- SwCrsrSaveState aSaveState( *pCurCrsr );
+ // rhbz#689053: IsSelOvr must restore the saved stack position, not the
+ // current one, because current point + stack mark may be invalid PaM
+ SwCrsrSaveState aSaveState(*pCrsrStk);
if( pCrsrStk->HasMark() ) // nur wenn GetMark gesetzt wurde
{
bool const bResult =
CheckNodesRange( pCrsrStk->GetMark()->nNode, pCurCrsr->GetPoint()->nNode, sal_True );
OSL_ENSURE(bResult, "StackCrsr & act. Crsr not in same Section.");
(void) bResult; // non-debug: unused
- // kopiere das GetMark
- if( !pCurCrsr->HasMark() )
- pCurCrsr->SetMark();
- *pCurCrsr->GetMark() = *pCrsrStk->GetMark();
- pCurCrsr->GetMkPos() = pCrsrStk->GetMkPos();
}
+ *pCrsrStk->GetPoint() = *pCurCrsr->GetPoint();
+ pCrsrStk->GetPtPos() = pCurCrsr->GetPtPos();
SwShellCrsr * pTmp = 0;
if( pCrsrStk->GetNext() != pCrsrStk )
{
pTmp = dynamic_cast<SwShellCrsr*>(pCrsrStk->GetNext());
}
- delete pCrsrStk;
+ delete pCurCrsr;
+ pCurCrsr = pCrsrStk;
+ pCrsrStk->MoveTo(0); // remove from ring
pCrsrStk = pTmp;
if( !pCurCrsr->IsInProtectTable( sal_True ) &&
!pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |