Kaydet (Commit) bcc96bd2 authored tarafından Michael Stahl's avatar Michael Stahl

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 a624cf52)

Change-Id: Id796d2e230de065113bcf1e6164d6b8a01ab933c
(cherry picked from commit 8a1f5536)
üst 7657db1f
......@@ -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-- );
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment