diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-04 20:36:53 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-06 20:40:21 -0500 |
commit | df8257faf64b01f3de26277742195693ddfe29fc (patch) | |
tree | 344e21796463d80d6fdb450864bceba9bdf5d8a7 /sc/source/ui/vba | |
parent | 55107688ea606d229ccdb12df6e570ae02db1999 (diff) |
Check all call sites of CompileString() and make sure we don't leak.
We *were* leaking quite a bit.
Change-Id: I3f53eff22beab27b34a055a4452311f2e2f771db
Diffstat (limited to 'sc/source/ui/vba')
-rw-r--r-- | sc/source/ui/vba/vbaname.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/vba/vbanames.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/vba/vbarange.cxx | 7 |
3 files changed, 12 insertions, 5 deletions
diff --git a/sc/source/ui/vba/vbaname.cxx b/sc/source/ui/vba/vbaname.cxx index fc5592b75276..3c3d44859750 100644 --- a/sc/source/ui/vba/vbaname.cxx +++ b/sc/source/ui/vba/vbaname.cxx @@ -34,6 +34,8 @@ #include "compiler.hxx" #include "tokenarray.hxx" +#include <boost/scoped_ptr.hpp> + using namespace ::ooo::vba; using namespace ::com::sun::star; @@ -135,8 +137,8 @@ void ScVbaName::setContent( const OUString& rContent, const formula::FormulaGra // Shorter way of doing this ? ScCompiler aComp( pDoc, pOldData->GetPos() ); aComp.SetGrammar( eGrammar ); - ScTokenArray aArray(*aComp.CompileString( sContent ) ); - pOldData->SetCode( aArray ); + boost::scoped_ptr<ScTokenArray> pArray(aComp.CompileString(sContent)); + pOldData->SetCode(*pArray); } } } diff --git a/sc/source/ui/vba/vbanames.cxx b/sc/source/ui/vba/vbanames.cxx index eb1c4ab39662..c3001c4b7789 100644 --- a/sc/source/ui/vba/vbanames.cxx +++ b/sc/source/ui/vba/vbanames.cxx @@ -34,6 +34,8 @@ #include "tokenarray.hxx" #include "cellsuno.hxx" +#include <boost/scoped_ptr.hpp> + using namespace ::ooo::vba; using namespace ::com::sun::star; @@ -158,7 +160,7 @@ ScVbaNames::Add( const css::uno::Any& Name , ScAddress aBlank; ScCompiler aComp( getScDocument(), aBlank ); aComp.SetGrammar( eGram ); - ScTokenArray* pTokens = aComp.CompileString( sFormula ); + boost::scoped_ptr<ScTokenArray> pTokens(aComp.CompileString(sFormula)); if ( pTokens ) { ScRange aRange; diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index b533561d4a42..a5517806b3ab 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -172,6 +172,9 @@ #include <com/sun/star/bridge/oleautomation/Date.hpp> #include "tokenarray.hxx" #include "tokenuno.hxx" + +#include <boost/scoped_ptr.hpp> + using namespace ::ooo::vba; using namespace ::com::sun::star; using ::std::vector; @@ -901,7 +904,7 @@ protected: ScCompiler aCompiler( m_pDoc, aCellRanges.front()->aStart ); aCompiler.SetGrammar(m_eGrammar); // compile the string in the format passed in - aCompiler.CompileString( sFormula ); + boost::scoped_ptr<ScTokenArray> pArray(aCompiler.CompileString(sFormula)); // set desired convention to that of the document aCompiler.SetGrammar( formula::FormulaGrammar::GRAM_PODF_A1 ); OUString sConverted; @@ -944,7 +947,7 @@ public: ScRangeList aCellRanges = pUnoRangesBase->GetRangeList(); ScCompiler aCompiler( m_pDoc, aCellRanges.front()->aStart ); aCompiler.SetGrammar(formula::FormulaGrammar::GRAM_DEFAULT); - aCompiler.CompileString( sVal ); + boost::scoped_ptr<ScTokenArray> pArray(aCompiler.CompileString(sVal)); // set desired convention aCompiler.SetGrammar( m_eGrammar ); OUString sConverted; |