diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-05-17 13:43:18 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-05-20 20:17:28 -0400 |
commit | 9cf69e73e6e20fda2518c27e617cc990e95d60ee (patch) | |
tree | 8e075636282750bafc5dbe921beec3d78bdefa0a /sc | |
parent | f72dadc3df3194e1fde075b266348d169f28af38 (diff) |
Make it exception safe.
Change-Id: Ib9b734ac9800b1ecf005dcd3a66beac6fcfc3a4f
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/document.cxx | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 8bd935d06f44..6ca6fc05e74d 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -94,6 +94,7 @@ #include <map> #include <limits> +#include <boost/scoped_ptr.hpp> using ::editeng::SvxBorderLine; using namespace ::com::sun::star; @@ -2873,7 +2874,7 @@ void ScDocument::FillTab( const ScRange& rSrcArea, const ScMarkData& rMark, SCROW nStartRow = rSrcArea.aStart.Row(); SCCOL nEndCol = rSrcArea.aEnd.Col(); SCROW nEndRow = rSrcArea.aEnd.Row(); - ScDocument* pMixDoc = NULL; + boost::scoped_ptr<ScDocument> pMixDoc; bool bDoMix = ( bSkipEmpty || nFunction ) && ( nFlags & IDF_CONTENTS ); bool bOldAutoCalc = GetAutoCalc(); @@ -2891,7 +2892,7 @@ void ScDocument::FillTab( const ScRange& rSrcArea, const ScMarkData& rMark, { if (!pMixDoc) { - pMixDoc = new ScDocument( SCDOCMODE_UNDO ); + pMixDoc.reset(new ScDocument(SCDOCMODE_UNDO)); pMixDoc->InitUndo( this, i, i ); } else @@ -2910,8 +2911,6 @@ void ScDocument::FillTab( const ScRange& rSrcArea, const ScMarkData& rMark, nFunction, bSkipEmpty, pMixDoc->maTabs[i] ); } - delete pMixDoc; - SetAutoCalc( bOldAutoCalc ); } else @@ -2931,7 +2930,7 @@ void ScDocument::FillTabMarked( SCTAB nSrcTab, const ScMarkData& rMark, if (ValidTab(nSrcTab) && nSrcTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nSrcTab]) { - ScDocument* pMixDoc = NULL; + boost::scoped_ptr<ScDocument> pMixDoc; bool bDoMix = ( bSkipEmpty || nFunction ) && ( nFlags & IDF_CONTENTS ); bool bOldAutoCalc = GetAutoCalc(); @@ -2956,7 +2955,7 @@ void ScDocument::FillTabMarked( SCTAB nSrcTab, const ScMarkData& rMark, { if (!pMixDoc) { - pMixDoc = new ScDocument( SCDOCMODE_UNDO ); + pMixDoc.reset(new ScDocument(SCDOCMODE_UNDO)); pMixDoc->InitUndo( this, i, i ); } else @@ -2976,8 +2975,6 @@ void ScDocument::FillTabMarked( SCTAB nSrcTab, const ScMarkData& rMark, maTabs[i]->MixMarked( rMark, nFunction, bSkipEmpty, pMixDoc->maTabs[i] ); } - delete pMixDoc; - SetAutoCalc( bOldAutoCalc ); } else |