summaryrefslogtreecommitdiff
path: root/sw/source/uibase/wrtsh/select.cxx
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2014-05-31 22:29:14 +0900
committerTakeshi Abe <tabe@fixedpoint.jp>2014-05-31 22:30:40 +0900
commitb32ee047312a49c13a247aa57485fad128f13317 (patch)
treed48f832c0c94ae167de8ec7bd88b30cd95f16295 /sw/source/uibase/wrtsh/select.cxx
parentd2d2136f3f1ecfa03713ff4231ad6214ca6a9c33 (diff)
Avoid possible memory leaks in case of exceptions
Change-Id: I1988d2766d8bdeb5f8a22a5673dcff9b898dd637
Diffstat (limited to 'sw/source/uibase/wrtsh/select.cxx')
-rw-r--r--sw/source/uibase/wrtsh/select.cxx11
1 files changed, 5 insertions, 6 deletions
diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx
index 76a4c2eb8d66..29fa6c402aca 100644
--- a/sw/source/uibase/wrtsh/select.cxx
+++ b/sw/source/uibase/wrtsh/select.cxx
@@ -39,6 +39,7 @@
#include <crsskip.hxx>
#include <doc.hxx>
#include <wordcountdialog.hxx>
+#include <boost/scoped_ptr.hpp>
namespace com { namespace sun { namespace star { namespace util {
struct SearchOptions;
@@ -128,8 +129,8 @@ long SwWrtShell::SelAll()
LeaveBlockMode();
SwMvContext aMvContext(this);
bool bMoveTable = false;
- SwPosition *pStartPos = 0;
- SwPosition *pEndPos = 0;
+ boost::scoped_ptr<SwPosition> pStartPos;
+ boost::scoped_ptr<SwPosition> pEndPos;
SwShellCrsr* pTmpCrsr = 0;
if( !HasWholeTabSelection() )
{
@@ -138,8 +139,8 @@ long SwWrtShell::SelAll()
pTmpCrsr = getShellCrsr( false );
if( pTmpCrsr )
{
- pStartPos = new SwPosition( *pTmpCrsr->GetPoint() );
- pEndPos = new SwPosition( *pTmpCrsr->GetMark() );
+ pStartPos.reset(new SwPosition( *pTmpCrsr->GetPoint() ));
+ pEndPos.reset(new SwPosition( *pTmpCrsr->GetMark() ));
}
Push();
bool bIsFullSel = !MoveSection( fnSectionCurr, fnSectionStart);
@@ -187,8 +188,6 @@ long SwWrtShell::SelAll()
*pEndPos == *pTmpCrsr->GetPoint() ) ) && !bStartsWithTable)
SwCrsrShell::SttEndDoc(false);
}
- delete pStartPos;
- delete pEndPos;
}
}
EndSelect();