[Libreoffice-commits] core.git: sc/source sw/source vcl/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Nov 7 11:02:33 UTC 2016


 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(-)

New commits:
commit febde9d61d1ee848f7b10edfd5954a25b6687946
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Nov 7 10:41:17 2016 +0200

    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 <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 12f1f31..f661f34 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<AbstractScDPShowDetailDlg> 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<AbstractScDPDateGroupDlg> 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<AbstractScDPNumGroupDlg> 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 153f15a..38b45e5 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<AbstractSwFieldDlg> 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 9cd0adc..8865d29 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<AbstractMailMergeCreateFromDlg> 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<AbstractMailMergeFieldConnectionsDlg> 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 8bed651..872c235 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<AbstractScreenshotAnnotationDlg> pTmp = pFact->CreateScreenshotAnnotationDlg(
                                     Application::GetDefDialogParent(),
                                     *pParentDialog);
                                 ScopedVclPtr<AbstractScreenshotAnnotationDlg> pDialog(pTmp);


More information about the Libreoffice-commits mailing list