summaryrefslogtreecommitdiff
path: root/sw/source/filter/basflt
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-08-09 18:43:36 +0200
committerCaolán McNamara <caolanm@redhat.com>2019-08-10 12:38:08 +0200
commit3c367de9893b1e2d352585a42cbbd25052bb7376 (patch)
tree02045c4f68150560374b5e90a37d11fc0cf4de9b /sw/source/filter/basflt
parentba61c3174bc24bc03e3f72fbc8d102b3312b5ff6 (diff)
sw: fix ~SwIndexReg asserts on ODF export of ooo83072-1.odt
It is now possible that the stupid redline-moving code deletes the first node in the document, and there are 2 SwPaM that point to it, Writer::m_pCurrentPam and local pPam in SwWriter::Write(). So i thought it should be quite trivial to just use SwUnoCursors in these cases, but it required a bit more keyboard bashing than expected. (regression from beec1594587d0bf1ea2268f9a435c948b5580278, which i didn't really intend to push and am not sure if it's really a good idea but whatever...) Change-Id: Ia5c18d67af8760664517a4b7ee62ef3e4a417686 Reviewed-on: https://gerrit.libreoffice.org/77225 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/filter/basflt')
-rw-r--r--sw/source/filter/basflt/shellio.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 66c9d1d0ea7d..37426ccd1c40 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -730,6 +730,7 @@ ErrCode SwWriter::Write( WriterRef const & rxWriter, const OUString* pRealFileNa
SwPauseThreadStarting aPauseThreadStarting;
bool bHasMark = false;
+ std::shared_ptr<SwUnoCursor> pTempCursor;
SwPaM * pPam;
rtl::Reference<SwDoc> xDoc;
@@ -796,7 +797,9 @@ ErrCode SwWriter::Write( WriterRef const & rxWriter, const OUString* pRealFileNa
{
// no Shell or write-everything -> create a Pam
SwDoc* pOutDoc = xDoc.is() ? xDoc.get() : &rDoc;
- pPam = new SwPaM( pOutDoc->GetNodes().GetEndOfContent() );
+ pTempCursor = pOutDoc->CreateUnoCursor(
+ SwPosition(pOutDoc->GetNodes().GetEndOfContent()), false);
+ pPam = pTempCursor.get();
if( pOutDoc->IsClipBoard() )
{
pPam->Move( fnMoveBackward, GoInDoc );
@@ -877,7 +880,6 @@ ErrCode SwWriter::Write( WriterRef const & rxWriter, const OUString* pRealFileNa
}
else
{
- delete pPam; // delete the created Pam
// Everything was written successfully? Tell the document!
if ( !nError.IsError() && !xDoc.is() )
{