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

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


 sfx2/source/doc/objmisc.cxx      |    7 +++----
 sfx2/source/doc/objxtor.cxx      |    3 +--
 sfx2/source/doc/sfxbasemodel.cxx |    8 ++++----
 sfx2/source/inc/objshimp.hxx     |    2 +-
 sfx2/source/view/viewfrm.cxx     |    2 +-
 5 files changed, 10 insertions(+), 12 deletions(-)

New commits:
commit 5e93e406cbada31882c33fe1f420af29039027be
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Dec 4 15:03:33 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Dec 5 07:51:10 2018 +0100

    use unique_ptr in SfxBaseModel::storeSelf
    
    Change-Id: I73524a15b5ac33ee6243a2e0e563b9986e887e40
    Reviewed-on: https://gerrit.libreoffice.org/64528
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 254177efadf0..76be8c85d969 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1515,7 +1515,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const    Sequence< beans::PropertyValue >
             }
         }
 
-        SfxAllItemSet *pParams = new SfxAllItemSet( SfxGetpApp()->GetPool() );
+        std::unique_ptr<SfxAllItemSet> pParams(new SfxAllItemSet( SfxGetpApp()->GetPool() ));
         TransformParameters( nSlotId, aArgs, *pParams );
 
         SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::SaveDoc, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOC), m_pData->m_pObjectShell.get() ) );
@@ -1537,18 +1537,18 @@ void SAL_CALL SfxBaseModel::storeSelf( const    Sequence< beans::PropertyValue >
             }
             else
             {
-                bRet = m_pData->m_pObjectShell->Save_Impl( pParams );
+                bRet = m_pData->m_pObjectShell->Save_Impl( pParams.get() );
             }
         }
         else
         {
             // Tell the SfxMedium if we are in checkin instead of normal save
             m_pData->m_pObjectShell->GetMedium( )->SetInCheckIn( nSlotId == SID_CHECKIN );
-            bRet = m_pData->m_pObjectShell->Save_Impl( pParams );
+            bRet = m_pData->m_pObjectShell->Save_Impl( pParams.get() );
             m_pData->m_pObjectShell->GetMedium( )->SetInCheckIn( nSlotId != SID_CHECKIN );
         }
 
-        DELETEZ( pParams );
+        pParams.reset();
 
         ErrCode nErrCode = m_pData->m_pObjectShell->GetError() ? m_pData->m_pObjectShell->GetError()
                                                                : ERRCODE_IO_CANTWRITE;
commit 0cc702232e4799f03a468d1e8014d050a683165e
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Dec 4 15:00:43 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Dec 5 07:50:55 2018 +0100

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

diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index a199f99cb4d9..a7fc00a38aa8 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -985,13 +985,12 @@ void SfxObjectShell::CheckForBrokenDocSignatures_Impl()
 void SfxObjectShell::SetAutoLoad(
     const INetURLObject& rUrl, sal_uInt32 nTime, bool bReload )
 {
-    if ( pImpl->pReloadTimer )
-        DELETEZ(pImpl->pReloadTimer);
+    pImpl->pReloadTimer.reset();
     if ( bReload )
     {
-        pImpl->pReloadTimer = new AutoReloadTimer_Impl(
+        pImpl->pReloadTimer.reset(new AutoReloadTimer_Impl(
                                 rUrl.GetMainURL( INetURLObject::DecodeMechanism::ToIUri ),
-                                nTime, this );
+                                nTime, this ));
         pImpl->pReloadTimer->Start();
     }
 }
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index ac2fd4eca9d3..093fbbc4ecc9 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -233,7 +233,6 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell )
     ,m_bConfigOptionsChecked( false )
     ,lErr(ERRCODE_NONE)
     ,nEventId ( SfxEventHintId::NONE )
-    ,pReloadTimer ( nullptr)
     ,nLoadedFlags ( SfxLoadedFlags::ALL )
     ,nFlagsInProgress( SfxLoadedFlags::NONE )
     ,bModalMode( false )
@@ -310,7 +309,7 @@ SfxObjectShell::~SfxObjectShell()
     SfxObjectShell::CloseInternal();
     pImpl->pBaseModel.set( nullptr );
 
-    DELETEZ( pImpl->pReloadTimer );
+    pImpl->pReloadTimer.reset();
 
     SfxApplication *pSfxApp = SfxGetpApp();
     if ( USHRT_MAX != pImpl->nVisualDocumentNumber && pSfxApp )
diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx
index 4f883c2f8d53..d31414b8588f 100644
--- a/sfx2/source/inc/objshimp.hxx
+++ b/sfx2/source/inc/objshimp.hxx
@@ -96,7 +96,7 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess
     ErrCode             lErr;
     SfxEventHintId      nEventId;           // If Open/Create as to be sent
                                             // before Activate
-    AutoReloadTimer_Impl *pReloadTimer;
+    std::unique_ptr<AutoReloadTimer_Impl> pReloadTimer;
     SfxLoadedFlags      nLoadedFlags;
     SfxLoadedFlags      nFlagsInProgress;
     bool                bModalMode;
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index a642771b2c1f..79fad18c8048 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -614,7 +614,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
                     pView = GetNext( *pView, xOldObj );
                 }
 
-                DELETEZ( xOldObj->Get_Impl()->pReloadTimer );
+                xOldObj->Get_Impl()->pReloadTimer.reset();
 
                 std::unique_ptr<SfxItemSet> pNewSet;
                 std::shared_ptr<const SfxFilter> pFilter = pMedium->GetFilter();


More information about the Libreoffice-commits mailing list