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

Takeshi Abe tabe at fixedpoint.jp
Tue Aug 29 08:34:20 UTC 2017


 svx/source/form/fmvwimp.cxx |    9 ++-------
 svx/source/inc/fmvwimp.hxx  |    4 +++-
 2 files changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 8514f192c9e385550b336e57997c9e0dbd3a9bc3
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Tue Aug 29 10:35:57 2017 +0900

    svx: FmXFormView owns m_pWatchStoredList
    
    so simplify code with std::unique_ptr.
    
    Change-Id: I640bcbde4a59a239b33229168fd48cac29a3fc4d
    Reviewed-on: https://gerrit.libreoffice.org/41663
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index 6cfe4314aac4..5ec7438bfb25 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -397,7 +397,6 @@ FmXFormView::FmXFormView(FmFormView* _pView )
     ,m_nErrorMessageEvent( nullptr )
     ,m_nAutoFocusEvent( nullptr )
     ,m_nControlWizardEvent( nullptr )
-    ,m_pWatchStoredList( nullptr )
     ,m_bFirstActivation( true )
     ,m_isTabOrderUpdateSuspended( false )
 {
@@ -455,9 +454,6 @@ FmXFormView::~FmXFormView()
     }
 
     cancelEvents();
-
-    delete m_pWatchStoredList;
-    m_pWatchStoredList = nullptr;
 }
 
 //      EventListener
@@ -1735,8 +1731,7 @@ void FmXFormView::stopMarkListWatching()
     if ( m_pWatchStoredList )
     {
         m_pWatchStoredList->EndListeningAll();
-        delete m_pWatchStoredList;
-        m_pWatchStoredList = nullptr;
+        m_pWatchStoredList.reset();
     }
 }
 
@@ -1749,7 +1744,7 @@ void FmXFormView::startMarkListWatching()
         DBG_ASSERT( pModel != nullptr, "FmXFormView::startMarkListWatching: shell has no model!" );
         if (pModel)
         {
-            m_pWatchStoredList = new ObjectRemoveListener( this );
+            m_pWatchStoredList.reset(new ObjectRemoveListener( this ));
             m_pWatchStoredList->StartListening( *static_cast< SfxBroadcaster* >( pModel ) );
         }
     }
diff --git a/svx/source/inc/fmvwimp.hxx b/svx/source/inc/fmvwimp.hxx
index 4f028144851a..7eb299d12a05 100644
--- a/svx/source/inc/fmvwimp.hxx
+++ b/svx/source/inc/fmvwimp.hxx
@@ -22,6 +22,7 @@
 #include <sal/config.h>
 
 #include <map>
+#include <memory>
 
 #include "svx/svdmark.hxx"
 #include "fmdocumentclassification.hxx"
@@ -171,7 +172,8 @@ class FmXFormView : public ::cppu::WeakImplHelper<
 
     // list of selected objects, used for restoration when switching from Alive to DesignMode
     SdrMarkList             m_aMark;
-    ObjectRemoveListener*   m_pWatchStoredList;
+    std::unique_ptr<ObjectRemoveListener>
+                    m_pWatchStoredList;
 
     bool            m_bFirstActivation;
     bool            m_isTabOrderUpdateSuspended;


More information about the Libreoffice-commits mailing list