[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sw/source
Michael Stahl
mstahl at redhat.com
Wed Jun 17 05:19:42 PDT 2015
sw/source/core/doc/docedt.cxx | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
New commits:
commit bcc96bd249cb122968ac35222a0fbc46f5d4a304
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Jun 17 14:00:05 2015 +0200
sw: fix assert on exporting ooo75410-1.doc to WW8
Apparently it may happen that some fly does get a different anchor node
than before, which means the RemoveAnchoredFly() will be called twice.
Prevent the problem differently by clearing the anchor in
_SaveFlyInRange().
(regression from a624cf52ab08b18b08711567799a08f47c48f89b)
Change-Id: Id796d2e230de065113bcf1e6164d6b8a01ab933c
(cherry picked from commit 8a1f55365ca609c1f2a79e9067b4857fae19b202)
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index dafbb2a..1326422 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -77,9 +77,8 @@ void _RestFlyInRange( _SaveFlyArr & rArr, const SwNodeIndex& rSttIdx,
SwFormatAnchor aAnchor( pFormat->GetAnchor() );
aAnchor.SetAnchor( &aPos );
pFormat->GetDoc()->GetSpzFrameFormats()->push_back( pFormat );
+ // SetFormatAttr should call Modify() and add it to the node
pFormat->SetFormatAttr( aAnchor );
- // SetFormatAttr will not call Modify() because the node is the same :-/
- aPos.nNode.GetNode().AddAnchoredFly(pFormat);
SwContentNode* pCNd = aPos.nNode.GetNode().GetContentNode();
if( pCNd && pCNd->getLayoutFrm( pFormat->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), 0, 0, false ) )
pFormat->MakeFrms();
@@ -104,7 +103,10 @@ void _SaveFlyInRange( const SwNodeRange& rRg, _SaveFlyArr& rArr )
pFormat, false );
rArr.push_back( aSave );
pFormat->DelFrms();
- pAPos->nNode.GetNode().RemoveAnchoredFly(pFormat);
+ // set a dummy anchor position to maintain anchoring invariants
+ SwFormatAnchor aAnchor( pFormat->GetAnchor() );
+ aAnchor.SetAnchor(nullptr);
+ pFormat->SetFormatAttr(aAnchor);
rFormats.erase( rFormats.begin() + n-- );
}
}
@@ -168,7 +170,10 @@ void _SaveFlyInRange( const SwPaM& rPam, const SwNodeIndex& rInsPos,
pFormat, bInsPos );
rArr.push_back( aSave );
pFormat->DelFrms();
- pAPos->nNode.GetNode().RemoveAnchoredFly(pFormat);
+ // set a dummy anchor position to maintain anchoring invariants
+ SwFormatAnchor aAnchor( pFormat->GetAnchor() );
+ aAnchor.SetAnchor(nullptr);
+ pFormat->SetFormatAttr(aAnchor);
rFormats.erase( rFormats.begin() + n-- );
}
}
More information about the Libreoffice-commits
mailing list