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

Noel Grandin noel.grandin at collabora.co.uk
Sat May 5 06:59:12 UTC 2018


 include/svx/gridctrl.hxx       |    2 +-
 svx/source/fmcomp/gridctrl.cxx |   10 +++-------
 2 files changed, 4 insertions(+), 8 deletions(-)

New commits:
commit 65b7024b982c10b7998e7cb0fb2b8165b7a8ffb6
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri May 4 16:45:37 2018 +0200

    loplugin:useuniqueptr in DbGridControl
    
    Change-Id: Ia5b1181ae58ce69871a66f58080435f8511cc815
    Reviewed-on: https://gerrit.libreoffice.org/53883
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/svx/gridctrl.hxx b/include/svx/gridctrl.hxx
index 80c2b6aad5ff..32bbd965b579 100644
--- a/include/svx/gridctrl.hxx
+++ b/include/svx/gridctrl.hxx
@@ -255,7 +255,7 @@ private:
     void*                                           m_pFieldListeners;
         // property listeners for field values
 
-    DisposeListenerGridBridge*                      m_pCursorDisposeListener;
+    std::unique_ptr<DisposeListenerGridBridge>      m_pCursorDisposeListener;
         // need to know about the diposing of the seek cursor
         // construct analogous to the data source proplistener/multiplexer above :
         // DisposeListenerGridBridge is a bridge from FmXDisposeListener which I don't want to be derived from
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index 8093bddd31b9..97d156337440 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -1013,11 +1013,7 @@ void DbGridControl::dispose()
         osl::MutexGuard aGuard(m_aDestructionSafety);
         if (m_pFieldListeners)
             DisconnectFromFields();
-        if (m_pCursorDisposeListener)
-        {
-            delete m_pCursorDisposeListener;
-            m_pCursorDisposeListener = nullptr;
-        }
+        m_pCursorDisposeListener.reset();
     }
 
     if (m_nDeleteEvent)
@@ -1442,7 +1438,7 @@ void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, DbGridCo
     RemoveRows();
     DisconnectFromFields();
 
-    DELETEZ(m_pCursorDisposeListener);
+    m_pCursorDisposeListener.reset();
 
     {
         ::osl::MutexGuard aGuard(m_aAdjustSafety);
@@ -1640,7 +1636,7 @@ void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, DbGridCo
 
     // start listening on the seek cursor
     if (m_pSeekCursor)
-        m_pCursorDisposeListener = new DisposeListenerGridBridge(*this, Reference< XComponent > (Reference< XInterface >(*m_pSeekCursor), UNO_QUERY));
+        m_pCursorDisposeListener.reset(new DisposeListenerGridBridge(*this, Reference< XComponent > (Reference< XInterface >(*m_pSeekCursor), UNO_QUERY)));
 }
 
 void DbGridControl::RemoveColumns()


More information about the Libreoffice-commits mailing list