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 @@ ...@@ -41,6 +41,7 @@
#define ScPivotShell #define ScPivotShell
#include "scslots.hxx" #include "scslots.hxx"
#include <boost/scoped_ptr.hpp>
TYPEINIT1( ScPivotShell, SfxShell ); TYPEINIT1( ScPivotShell, SfxShell );
...@@ -107,8 +108,8 @@ void ScPivotShell::Execute( SfxRequest& rReq ) ...@@ -107,8 +108,8 @@ void ScPivotShell::Execute( SfxRequest& rReq )
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
AbstractScPivotFilterDlg* pDlg = pFact->CreateScPivotFilterDlg( boost::scoped_ptr<AbstractScPivotFilterDlg> pDlg(pFact->CreateScPivotFilterDlg(
pViewShell->GetDialogParent(), aArgSet, nSrcTab); pViewShell->GetDialogParent(), aArgSet, nSrcTab));
OSL_ENSURE(pDlg, "Dialog create fail!"); OSL_ENSURE(pDlg, "Dialog create fail!");
if( pDlg->Execute() == RET_OK ) if( pDlg->Execute() == RET_OK )
...@@ -126,7 +127,6 @@ void ScPivotShell::Execute( SfxRequest& rReq ) ...@@ -126,7 +127,6 @@ void ScPivotShell::Execute( SfxRequest& rReq )
aFunc.DataPilotUpdate( pDPObj, &aNewObj, true, false ); aFunc.DataPilotUpdate( pDPObj, &aNewObj, true, false );
pViewData->GetView()->CursorPosChanged(); // shells may be switched pViewData->GetView()->CursorPosChanged(); // shells may be switched
} }
delete pDlg;
} }
} }
break; break;
......
...@@ -81,6 +81,8 @@ using namespace com::sun::star; ...@@ -81,6 +81,8 @@ using namespace com::sun::star;
#define ScPreviewShell #define ScPreviewShell
#include "scslots.hxx" #include "scslots.hxx"
#include <boost/scoped_ptr.hpp>
TYPEINIT1( ScPreviewShell, SfxViewShell ); TYPEINIT1( ScPreviewShell, SfxViewShell );
SFX_IMPL_INTERFACE(ScPreviewShell, SfxViewShell, ScResId(SCSTR_PREVIEWSHELL)) SFX_IMPL_INTERFACE(ScPreviewShell, SfxViewShell, ScResId(SCSTR_PREVIEWSHELL))
...@@ -651,7 +653,7 @@ void ScPreviewShell::Execute( SfxRequest& rReq ) ...@@ -651,7 +653,7 @@ void ScPreviewShell::Execute( SfxRequest& rReq )
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if(pFact) if(pFact)
{ {
AbstractSvxZoomDialog* pDlg = pFact->CreateSvxZoomDialog(NULL, aSet); boost::scoped_ptr<AbstractSvxZoomDialog> pDlg(pFact->CreateSvxZoomDialog(NULL, aSet));
OSL_ENSURE(pDlg, "Dialogdiet fail!"); OSL_ENSURE(pDlg, "Dialogdiet fail!");
pDlg->SetLimits( 20, 400 ); pDlg->SetLimits( 20, 400 );
pDlg->HideButton( ZOOMBTN_OPTIMAL ); pDlg->HideButton( ZOOMBTN_OPTIMAL );
...@@ -666,8 +668,6 @@ void ScPreviewShell::Execute( SfxRequest& rReq ) ...@@ -666,8 +668,6 @@ void ScPreviewShell::Execute( SfxRequest& rReq )
eZoom = rZoomItem.GetType(); eZoom = rZoomItem.GetType();
nZoom = rZoomItem.GetValue(); 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