diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-04-02 22:32:59 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-04-03 07:25:23 +0000 |
commit | d8d946210a39400e4fc0b83f186e6234ad364836 (patch) | |
tree | bc853cce7c7184afba3789a901743c0d5128c1d5 | |
parent | c9812dc14828b3c8d48f5b765d1798c7cf3a5099 (diff) |
tdf#87400: sw: fix ~SwIndexReg assertion in AutoCorrect
SwAutoFormat::DoUnderline() calls DeleteSel() with a SwPaM that is not
corrected, except if it's passed along directly to SwDoc methods.
(regression from f9b62506b22c3eb885ffd5a4ec8025c33df7b2d4)
Change-Id: I741e0391e7f8e09a64bcfe99ca4d650f1016aaa7
(cherry picked from commit 41e4998cdeb54a6fc316f349de61296be820fe47)
Reviewed-on: https://gerrit.libreoffice.org/15127
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/source/core/edit/eddel.cxx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx index 3e4f06d0f5b2..8be74f310ee0 100644 --- a/sw/source/core/edit/eddel.cxx +++ b/sw/source/core/edit/eddel.cxx @@ -90,14 +90,20 @@ void SwEditShell::DeleteSel( SwPaM& rPam, bool* pUndo ) } else { - SwPaM aPam(rPam); + std::unique_ptr<SwPaM> pNewPam; + SwPaM * pPam = &rPam; if (bSelectAll) + { + assert(dynamic_cast<SwShellCrsr*>(&rPam)); // must be corrected pam + pNewPam.reset(new SwPaM(rPam)); // Selection starts at the first para of the first cell, but we // want to delete the table node before the first cell as well. - aPam.Start()->nNode = aPam.Start()->nNode.GetNode().FindTableNode()->GetIndex(); + pNewPam->Start()->nNode = pNewPam->Start()->nNode.GetNode().FindTableNode()->GetIndex(); + pPam = pNewPam.get(); + } // delete everything - GetDoc()->getIDocumentContentOperations().DeleteAndJoin( aPam ); - SaveTblBoxCntnt( aPam.GetPoint() ); + GetDoc()->getIDocumentContentOperations().DeleteAndJoin(*pPam); + SaveTblBoxCntnt( pPam->GetPoint() ); } // Selection is not needed anymore |