[Libreoffice-commits] core.git: sfx2/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 5 06:51:04 UTC 2018


 sfx2/source/view/viewfrm.cxx |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit a8694d21a87c44f6008a3547f0b004a17253fdd6
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Dec 4 14:59:06 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Dec 5 07:50:39 2018 +0100

    use unique_ptr in SfxViewFrame::ExecReload_Impl
    
    Change-Id: I35a8a3a6ccbf811e529f761f840bfc7acf870056
    Reviewed-on: https://gerrit.libreoffice.org/64526
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 61cb945c738a..a642771b2c1f 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -616,11 +616,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
 
                 DELETEZ( xOldObj->Get_Impl()->pReloadTimer );
 
-                SfxItemSet* pNewSet = nullptr;
+                std::unique_ptr<SfxItemSet> pNewSet;
                 std::shared_ptr<const SfxFilter> pFilter = pMedium->GetFilter();
                 if( pURLItem )
                 {
-                    pNewSet = new SfxAllItemSet( pApp->GetPool() );
+                    pNewSet.reset(new SfxAllItemSet( pApp->GetPool() ));
                     pNewSet->Put( *pURLItem );
 
                     // Filter Detection
@@ -637,7 +637,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
                 }
                 else
                 {
-                    pNewSet = new SfxAllItemSet( *pMedium->GetItemSet() );
+                    pNewSet.reset(new SfxAllItemSet( *pMedium->GetItemSet() ));
                     pNewSet->ClearItem( SID_VIEW_ID );
                     pNewSet->ClearItem( SID_STREAM );
                     pNewSet->ClearItem( SID_INPUTSTREAM );
@@ -657,7 +657,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
 
                 // If a salvaged file is present, do not enclose the OrigURL
                 // again, since the Template is invalid after reload.
-                const SfxStringItem* pSalvageItem = SfxItemSet::GetItem<SfxStringItem>(pNewSet, SID_DOC_SALVAGE, false);
+                const SfxStringItem* pSalvageItem = SfxItemSet::GetItem<SfxStringItem>(pNewSet.get(), SID_DOC_SALVAGE, false);
                 if( pSalvageItem )
                 {
                     pNewSet->ClearItem( SID_DOC_SALVAGE );
@@ -680,9 +680,9 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
                 if ( pSilentItem && pSilentItem->GetValue() )
                     pNewSet->Put( SfxBoolItem( SID_SILENT, true ) );
 
-                const SfxUnoAnyItem* pInteractionItem = SfxItemSet::GetItem<SfxUnoAnyItem>(pNewSet, SID_INTERACTIONHANDLER, false);
-                const SfxUInt16Item* pMacroExecItem = SfxItemSet::GetItem<SfxUInt16Item>(pNewSet, SID_MACROEXECMODE, false);
-                const SfxUInt16Item* pDocTemplateItem = SfxItemSet::GetItem<SfxUInt16Item>(pNewSet, SID_UPDATEDOCMODE, false);
+                const SfxUnoAnyItem* pInteractionItem = SfxItemSet::GetItem<SfxUnoAnyItem>(pNewSet.get(), SID_INTERACTIONHANDLER, false);
+                const SfxUInt16Item* pMacroExecItem = SfxItemSet::GetItem<SfxUInt16Item>(pNewSet.get(), SID_MACROEXECMODE, false);
+                const SfxUInt16Item* pDocTemplateItem = SfxItemSet::GetItem<SfxUInt16Item>(pNewSet.get(), SID_UPDATEDOCMODE, false);
 
                 if (!pInteractionItem)
                 {
@@ -734,7 +734,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
                     xNewObj = nullptr;
                 }
 
-                DELETEZ( pNewSet );
+                pNewSet.reset();
 
                 if( !xNewObj.Is() )
                 {


More information about the Libreoffice-commits mailing list