Kaydet (Commit) e62a3e87 authored tarafından Takeshi Abe's avatar Takeshi Abe

Avoid possible memory leaks in case of exceptions

Change-Id: I9cafee23bbf016024393550166aefdc782b488cb
üst a647ff1f
This diff is collapsed.
......@@ -41,6 +41,7 @@
#define ScPivotShell
#include "scslots.hxx"
#include <boost/scoped_ptr.hpp>
TYPEINIT1( ScPivotShell, SfxShell );
......@@ -107,8 +108,8 @@ void ScPivotShell::Execute( SfxRequest& rReq )
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
AbstractScPivotFilterDlg* pDlg = pFact->CreateScPivotFilterDlg(
pViewShell->GetDialogParent(), aArgSet, nSrcTab);
boost::scoped_ptr<AbstractScPivotFilterDlg> pDlg(pFact->CreateScPivotFilterDlg(
pViewShell->GetDialogParent(), aArgSet, nSrcTab));
OSL_ENSURE(pDlg, "Dialog create fail!");
if( pDlg->Execute() == RET_OK )
......@@ -126,7 +127,6 @@ void ScPivotShell::Execute( SfxRequest& rReq )
aFunc.DataPilotUpdate( pDPObj, &aNewObj, true, false );
pViewData->GetView()->CursorPosChanged(); // shells may be switched
}
delete pDlg;
}
}
break;
......
......@@ -81,6 +81,8 @@ using namespace com::sun::star;
#define ScPreviewShell
#include "scslots.hxx"
#include <boost/scoped_ptr.hpp>
TYPEINIT1( ScPreviewShell, SfxViewShell );
SFX_IMPL_INTERFACE(ScPreviewShell, SfxViewShell, ScResId(SCSTR_PREVIEWSHELL))
......@@ -651,7 +653,7 @@ void ScPreviewShell::Execute( SfxRequest& rReq )
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if(pFact)
{
AbstractSvxZoomDialog* pDlg = pFact->CreateSvxZoomDialog(NULL, aSet);
boost::scoped_ptr<AbstractSvxZoomDialog> pDlg(pFact->CreateSvxZoomDialog(NULL, aSet));
OSL_ENSURE(pDlg, "Dialogdiet fail!");
pDlg->SetLimits( 20, 400 );
pDlg->HideButton( ZOOMBTN_OPTIMAL );
......@@ -666,8 +668,6 @@ void ScPreviewShell::Execute( SfxRequest& rReq )
eZoom = rZoomItem.GetType();
nZoom = rZoomItem.GetValue();
}
delete pDlg;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment