summaryrefslogtreecommitdiff
path: root/basctl
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 /basctl
parentd2d2136f3f1ecfa03713ff4231ad6214ca6a9c33 (diff)
Avoid possible memory leaks in case of exceptions
Change-Id: I1988d2766d8bdeb5f8a22a5673dcff9b898dd637
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/macrodlg.cxx5
-rw-r--r--basctl/source/basicide/moduldl2.cxx10
2 files changed, 8 insertions, 7 deletions
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index 0802b17424c7..d5969d18becf 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -48,6 +48,7 @@
#include <com/sun/star/document/MacroExecMode.hpp>
#include <map>
+#include <boost/scoped_ptr.hpp>
namespace basctl
{
@@ -765,9 +766,9 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton )
StoreMacroDescription();
EntryDescriptor aDesc = m_pBasicBox->GetEntryDescriptor(m_pBasicBox->FirstSelected());
- OrganizeDialog* pDlg = new OrganizeDialog( this, 0, aDesc );
+ boost::scoped_ptr<OrganizeDialog> pDlg(new OrganizeDialog( this, 0, aDesc ));
sal_uInt16 nRet = pDlg->Execute();
- delete pDlg;
+ pDlg.reset();
if ( nRet ) // not only closed
{
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 7c6cca87672c..3a22d5714c16 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -64,6 +64,7 @@
#include <com/sun/star/script/ModuleSizeExceededRequest.hpp>
#include <cassert>
+#include <boost/scoped_ptr.hpp>
namespace basctl
{
@@ -636,7 +637,7 @@ IMPL_LINK( LibPage, ButtonHdl, Button *, pButton )
bool const bProtected = xPasswd->isLibraryPasswordProtected( aLibName );
// change password dialog
- SvxPasswordDialog* pDlg = new SvxPasswordDialog( this, true, !bProtected );
+ boost::scoped_ptr<SvxPasswordDialog> pDlg(new SvxPasswordDialog( this, true, !bProtected ));
pDlg->SetCheckPasswordHdl( LINK( this, LibPage, CheckPasswordHdl ) );
if ( pDlg->Execute() == RET_OK )
@@ -653,7 +654,6 @@ IMPL_LINK( LibPage, ButtonHdl, Button *, pButton )
MarkDocumentModified( m_aCurDocument );
}
- delete pDlg;
}
}
}
@@ -775,7 +775,7 @@ void LibPage::InsertLib()
if ( xModLibContImport.is() || xDlgLibContImport.is() )
{
- LibDialog* pLibDlg = 0;
+ boost::scoped_ptr<LibDialog> pLibDlg;
Reference< script::XLibraryContainer > xModLibContImp( xModLibContImport, UNO_QUERY );
Reference< script::XLibraryContainer > xDlgLibContImp( xDlgLibContImport, UNO_QUERY );
@@ -787,7 +787,7 @@ void LibPage::InsertLib()
// library import dialog
if ( !pLibDlg )
{
- pLibDlg = new LibDialog( this );
+ pLibDlg.reset(new LibDialog( this ));
pLibDlg->SetStorageName( aURLObj.getName() );
pLibDlg->GetLibBox().SetMode(ObjectMode::Library);
}
@@ -1044,7 +1044,7 @@ void LibPage::InsertLib()
m_pLibBox->SetCurEntry( pFirstNew );
}
- delete pLibDlg;
+ pLibDlg.reset();
if ( bChanges )
MarkDocumentModified( m_aCurDocument );
}