diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-04-22 12:13:33 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-04-22 12:45:52 +0100 |
commit | deaed8aff6de824a76d939a02edb0d2ff4a4ccec (patch) | |
tree | 35ac58a745b3d164753c40f0f11586f99688b33a | |
parent | 7aa166da24c81b7c22a0ec5daf7e09640ffb009b (diff) |
fix re-export of novell590442-1.ppt to ppt
we always close this container, even if we didn't open it
original commit always opened the SpgrContainer, and always
closed the SpgrContainer. (but seems to have a loophole, presumably
never hit where the SpContainer could be opened and not closed)
make a container guard which opens in ctor and closes in dtor.
should make ppt export crash stats hit 0
Change-Id: I2aead7397448b674e433a4097c97285067a6dc6e
-rw-r--r-- | sd/source/filter/eppt/epptso.cxx | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index 4132696ecf61..9885c0dc1fcf 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -3571,6 +3571,22 @@ void PPTWriter::WriteCString( SvStream& rSt, const OUString& rString, sal_uInt32 } } +class ContainerGuard +{ +private: + PptEscherEx* m_pPptEscherEx; +public: + ContainerGuard(PptEscherEx* pPptEscherEx, sal_uInt16 nRecord) + : m_pPptEscherEx(pPptEscherEx) + { + m_pPptEscherEx->OpenContainer(nRecord); + } + ~ContainerGuard() + { + m_pPptEscherEx->CloseContainer(); + } +}; + void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, EscherSolverContainer& aSolverContainer, EscherPropertyContainer& aPropOpt ) { @@ -3618,8 +3634,8 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc if ( y == nRowCount - 1 && nPosition != maRect.Bottom()) maRect.Bottom() = nPosition; } - mpPptEscherEx->OpenContainer( ESCHER_SpgrContainer ); - mpPptEscherEx->OpenContainer( ESCHER_SpContainer ); + std::unique_ptr<ContainerGuard> xSpgrContainer(new ContainerGuard(mpPptEscherEx, ESCHER_SpgrContainer)); + std::unique_ptr<ContainerGuard> xSpContainer(new ContainerGuard(mpPptEscherEx, ESCHER_SpContainer)); mpPptEscherEx->AddAtom( 16, ESCHER_Spgr, 1 ); mpStrm ->WriteInt32( maRect.Left() ) // Bounding box for the grouped shapes to which they are attached .WriteInt32( maRect.Top() ) @@ -3651,7 +3667,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc mpPptEscherEx->AddChildAnchor( maRect ); else mpPptEscherEx->AddClientAnchor( maRect ); - mpPptEscherEx->CloseContainer(); + xSpContainer.reset(); //ESCHER_SpContainer uno::Reference< table::XCellRange > xCellRange( xTable, uno::UNO_QUERY_THROW ); for( sal_Int32 nRow = 0; nRow < xRows->getCount(); nRow++ ) @@ -3676,7 +3692,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc aAny >>= mbFontIndependentLineSpacing; EscherPropertyContainer aPropOptSp; - mpPptEscherEx->OpenContainer( ESCHER_SpContainer ); + std::unique_ptr<ContainerGuard> xCellContainer(new ContainerGuard(mpPptEscherEx, ESCHER_SpContainer)); ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa02, aSolverContainer ); // Flags: Connector | HasSpt | Child aPropOptSp.CreateFillProperties( mXPropSet, true ); aPropOptSp.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 ); @@ -3711,7 +3727,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc .WriteUInt32( aClientTextBox.Tell() ); mpStrm->Write( aClientTextBox.GetData(), aClientTextBox.Tell() ); - mpPptEscherEx->CloseContainer(); + xCellContainer.reset(); } } } @@ -3830,12 +3846,13 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc } } } + + xSpgrContainer.reset(); //ESCHER_SpgrContainer } } catch( uno::Exception& ) { } - mpPptEscherEx->CloseContainer(); } void TextObjBinary::Write( SvStream* pStrm ) |