From febde9d61d1ee848f7b10edfd5954a25b6687946 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 7 Nov 2016 10:41:17 +0200 Subject: [PATCH] wrap some more dialog pointers in VclPtr and fix a couple of memory leaks in the process, some of them were not being deleted at all Change-Id: Icb5c948662ad3ba878eadfbc807f93cc35cfb228 Reviewed-on: https://gerrit.libreoffice.org/30651 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- sc/source/ui/view/cellsh1.cxx | 12 ++++++------ sw/source/uibase/fldui/fldwrap.cxx | 2 +- sw/source/uibase/uiview/view2.cxx | 4 ++-- vcl/source/window/layout.cxx | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 12f1f3184ea3..f661f347a54f 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -1079,8 +1079,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); - AbstractScDPShowDetailDlg* pDlg = pFact->CreateScDPShowDetailDlg( - pTabViewShell->GetDialogParent(), *pDPObj, nOrientation ); + ScopedVclPtr pDlg( pFact->CreateScDPShowDetailDlg( + pTabViewShell->GetDialogParent(), *pDPObj, nOrientation ) ); OSL_ENSURE(pDlg, "Dialog create fail!"); if ( pDlg->Execute() == RET_OK ) { @@ -1120,9 +1120,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE( pFact, "ScAbstractFactory create fail!" ); Date aNullDate( *GetViewData()->GetDocument()->GetFormatTable()->GetNullDate() ); - AbstractScDPDateGroupDlg* pDlg = pFact->CreateScDPDateGroupDlg( + ScopedVclPtr pDlg( pFact->CreateScDPDateGroupDlg( pTabViewShell->GetDialogParent(), - aNumInfo, nParts, aNullDate ); + aNumInfo, nParts, aNullDate ) ); OSL_ENSURE( pDlg, "Dialog create fail!" ); if( pDlg->Execute() == RET_OK ) { @@ -1134,8 +1134,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) { ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE( pFact, "ScAbstractFactory create fail!" ); - AbstractScDPNumGroupDlg* pDlg = pFact->CreateScDPNumGroupDlg( - pTabViewShell->GetDialogParent(), aNumInfo ); + ScopedVclPtr pDlg( pFact->CreateScDPNumGroupDlg( + pTabViewShell->GetDialogParent(), aNumInfo ) ); OSL_ENSURE( pDlg, "Dialog create fail!" ); if( pDlg->Execute() == RET_OK ) pTabViewShell->NumGroupDataPilot( pDlg->GetGroupInfo() ); diff --git a/sw/source/uibase/fldui/fldwrap.cxx b/sw/source/uibase/fldui/fldwrap.cxx index 153f15add5ac..38b45e577fa5 100644 --- a/sw/source/uibase/fldui/fldwrap.cxx +++ b/sw/source/uibase/fldui/fldwrap.cxx @@ -125,7 +125,7 @@ SwFieldDataOnlyDlgWrapper::SwFieldDataOnlyDlgWrapper( vcl::Window* _pParent, sal SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - AbstractSwFieldDlg* pDlg = pFact->CreateSwFieldDlg(pB, this, _pParent); + VclPtr pDlg = pFact->CreateSwFieldDlg(pB, this, _pParent); OSL_ENSURE(pDlg, "Dialog creation failed!"); pDlgInterface = pDlg; diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 9cd0adc773e5..8865d294597a 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1138,7 +1138,7 @@ void SwView::Execute(SfxRequest &rReq) SfxViewFrame* pTmpFrame = GetViewFrame(); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialog creation failed!"); - AbstractMailMergeCreateFromDlg* pDlg = pFact->CreateMailMergeCreateFromDlg(&pTmpFrame->GetWindow()); + ScopedVclPtr pDlg( pFact->CreateMailMergeCreateFromDlg(&pTmpFrame->GetWindow()) ); OSL_ENSURE(pDlg, "Dialog creation failed!"); if(RET_OK == pDlg->Execute()) bUseCurrentDocument = pDlg->IsThisDocument(); @@ -2340,7 +2340,7 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument) //take an existing data source or create a new one? SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialog creation failed!"); - AbstractMailMergeFieldConnectionsDlg* pConnectionsDlg = pFact->CreateMailMergeFieldConnectionsDlg(&GetViewFrame()->GetWindow()); + ScopedVclPtr pConnectionsDlg( pFact->CreateMailMergeFieldConnectionsDlg(&GetViewFrame()->GetWindow()) ); OSL_ENSURE(pConnectionsDlg, "Dialog creation failed!"); if(RET_OK == pConnectionsDlg->Execute()) bCallAddressPilot = !pConnectionsDlg->IsUseExistingConnections(); diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 8bed6514a066..872c2357d504 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -308,7 +308,7 @@ void VclContainer::Command(const CommandEvent& rCEvt) { // open screenshot annotation dialog VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create(); - AbstractScreenshotAnnotationDlg* pTmp = pFact->CreateScreenshotAnnotationDlg( + VclPtr pTmp = pFact->CreateScreenshotAnnotationDlg( Application::GetDefDialogParent(), *pParentDialog); ScopedVclPtr pDialog(pTmp);