diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-02-12 11:23:26 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-02-12 12:33:00 -0500 |
commit | 0585322e70d3c0f1d26d6bd9c04a388a1ff55abf (patch) | |
tree | bd206df6f4f80ab4ea461137deccb6887dc72777 /sc/source/filter/rtf | |
parent | 117b3a13b82aaac0977fd17ee5b7b63204e659f4 (diff) |
Go through all ScEditCell instantiations and fix memory leaks.
Changed the signature of the constructor (one that clones the text object)
to take a reference instead of a pointer, to smoke out the callers that
use this constructor. Went through all its callers and made changes to
either 1) pass ownership to the cell instance (if the text object uses
the SfxItemPool instance returned from ScDocument::GetEditPool()), or 2)
pass as const reference to make it clear that the instance will get cloned.
Change-Id: I669e066d4739536bf8d3b356186503dcdfa303b0
Diffstat (limited to 'sc/source/filter/rtf')
-rw-r--r-- | sc/source/filter/rtf/eeimpars.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx index 95dba198c1ec..522ab3b0af91 100644 --- a/sc/source/filter/rtf/eeimpars.cxx +++ b/sc/source/filter/rtf/eeimpars.cxx @@ -56,6 +56,8 @@ #include "globstr.hrc" +#include <boost/scoped_ptr.hpp> + // in fuins1.cxx extern void ScLimitSizeOnDrawPage( Size& rSize, Point& rPos, const Size& rPage ); @@ -68,7 +70,7 @@ ScEEImport::ScEEImport( ScDocument* pDocP, const ScRange& rRange ) : { const ScPatternAttr* pPattern = mpDoc->GetPattern( maRange.aStart.Col(), maRange.aStart.Row(), maRange.aStart.Tab() ); - mpEngine = new ScTabEditEngine( *pPattern, mpDoc->GetEditPool() ); + mpEngine = new ScTabEditEngine(*pPattern, mpDoc->GetEditPool(), mpDoc->GetEditPool()); mpEngine->SetUpdateMode( false ); mpEngine->EnableUndo( false ); } @@ -394,10 +396,9 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu } else { - EditTextObject* pObject = mpEngine->CreateTextObject( pE->aSel ); - mpDoc->PutCell( nCol, nRow, nTab, new ScEditCell( pObject, - mpDoc, mpEngine->GetEditTextObjectPool() ) ); - delete pObject; + // The cell will own the text object instance. + mpDoc->PutCell( + nCol, nRow, nTab, new ScEditCell(mpEngine->CreateTextObject(pE->aSel), mpDoc)); } if ( pE->maImageList.size() ) bHasGraphics |= GraphicSize( nCol, nRow, nTab, pE ); |