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

sw: fix crash in sw_unoapi due to calling wrong SwTxtPortion ctor

Crash in sw.SwXTextRange because the SwTxtPortion copy ctor is
invoked, which copies the portion type POR_LAY, but SwTxtPortion
must have POR_TXT.

(hilarious regression from 2db379e2)

Change-Id: I781191a60dafeba2257edf01699fafae78b45783
üst 0bfc98e6
...@@ -139,7 +139,7 @@ SwLinePortion *SwLineLayout::Insert( SwLinePortion *pIns ) ...@@ -139,7 +139,7 @@ SwLinePortion *SwLineLayout::Insert( SwLinePortion *pIns )
{ {
if( GetLen() ) if( GetLen() )
{ {
pPortion = new SwTxtPortion(*this); pPortion = new SwTxtPortion(*static_cast<SwLinePortion*>(this));
if( IsBlinking() && pBlink ) if( IsBlinking() && pBlink )
{ {
SetBlinking( false ); SetBlinking( false );
...@@ -161,7 +161,7 @@ SwLinePortion *SwLineLayout::Append( SwLinePortion *pIns ) ...@@ -161,7 +161,7 @@ SwLinePortion *SwLineLayout::Append( SwLinePortion *pIns )
// First attribute change: copy mass and length from *pIns into the first // First attribute change: copy mass and length from *pIns into the first
// text portion // text portion
if( !pPortion ) if( !pPortion )
pPortion = new SwTxtPortion(*this); pPortion = new SwTxtPortion(*static_cast<SwLinePortion*>(this));
// Call with scope or we'll end up with recursion! // Call with scope or we'll end up with recursion!
return pPortion->SwLinePortion::Append( pIns ); return pPortion->SwLinePortion::Append( pIns );
} }
...@@ -184,7 +184,7 @@ SwMarginPortion *SwLineLayout::CalcLeftMargin() ...@@ -184,7 +184,7 @@ SwMarginPortion *SwLineLayout::CalcLeftMargin()
SwMarginPortion *pLeft = (GetPortion() && GetPortion()->IsMarginPortion()) ? SwMarginPortion *pLeft = (GetPortion() && GetPortion()->IsMarginPortion()) ?
static_cast<SwMarginPortion *>(GetPortion()) : 0; static_cast<SwMarginPortion *>(GetPortion()) : 0;
if( !GetPortion() ) if( !GetPortion() )
SetPortion(new SwTxtPortion(*this)); SetPortion(new SwTxtPortion(*static_cast<SwLinePortion*>(this)));
if( !pLeft ) if( !pLeft )
{ {
pLeft = new SwMarginPortion( 0 ); pLeft = new SwMarginPortion( 0 );
......
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