diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-04-02 22:32:59 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-04-02 23:53:30 +0200 |
commit | 41e4998cdeb54a6fc316f349de61296be820fe47 (patch) | |
tree | f4c64478eefee1f1bf6b83d7138a2b8e40cb3e35 | |
parent | a6376855d773282ab680c36002b3037cb0a4a9b1 (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
-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 a70011655207..313d079856fb 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 |