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

Noel Grandin noel.grandin at collabora.co.uk
Mon May 14 09:10:36 UTC 2018


 dbaccess/source/core/api/RowSet.cxx                        |   17 ++++++-------
 dbaccess/source/core/api/RowSet.hxx                        |    2 -
 dbaccess/source/core/inc/tablecontainer.hxx                |    5 ++-
 dbaccess/source/ext/macromigration/macromigrationpages.cxx |    6 ++--
 dbaccess/source/ext/macromigration/macromigrationpages.hxx |    2 -
 5 files changed, 16 insertions(+), 16 deletions(-)

New commits:
commit 0f53efefe14285101ee95a2f8a202b30f7089ea9
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue May 8 12:58:00 2018 +0200

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

diff --git a/dbaccess/source/ext/macromigration/macromigrationpages.cxx b/dbaccess/source/ext/macromigration/macromigrationpages.cxx
index 09fd1f69b495..d4b84e5982e6 100644
--- a/dbaccess/source/ext/macromigration/macromigrationpages.cxx
+++ b/dbaccess/source/ext/macromigration/macromigrationpages.cxx
@@ -79,8 +79,8 @@ namespace dbmm
         get(m_pStartMigration, "startmigrate");
         get(m_pBrowseSaveAsLocation, "browse");
         get(m_pSaveAsLocation, "location");
-        m_pLocationController = new svx::DatabaseLocationInputController(
-            _rParentDialog.getComponentContext(), *m_pSaveAsLocation, *m_pBrowseSaveAsLocation);
+        m_pLocationController.reset( new svx::DatabaseLocationInputController(
+            _rParentDialog.getComponentContext(), *m_pSaveAsLocation, *m_pBrowseSaveAsLocation) );
 
         m_pSaveAsLocation->SetModifyHdl( LINK( this, SaveDBDocPage, OnLocationModified ) );
         m_pSaveAsLocation->SetDropDownLineCount( 20 );
@@ -95,7 +95,7 @@ namespace dbmm
 
     void SaveDBDocPage::dispose()
     {
-        delete m_pLocationController;
+        m_pLocationController.reset();
         m_pSaveAsLocation.clear();
         m_pBrowseSaveAsLocation.clear();
         m_pStartMigration.clear();
diff --git a/dbaccess/source/ext/macromigration/macromigrationpages.hxx b/dbaccess/source/ext/macromigration/macromigrationpages.hxx
index 6bba4ef64a27..8c28cfd3076d 100644
--- a/dbaccess/source/ext/macromigration/macromigrationpages.hxx
+++ b/dbaccess/source/ext/macromigration/macromigrationpages.hxx
@@ -83,7 +83,7 @@ namespace dbmm
         VclPtr< ::svt::OFileURLControl>  m_pSaveAsLocation;
         VclPtr<PushButton>             m_pBrowseSaveAsLocation;
         VclPtr<FixedText>              m_pStartMigration;
-        svx::DatabaseLocationInputController* m_pLocationController;
+        std::unique_ptr<svx::DatabaseLocationInputController> m_pLocationController;
 
         // IWizardPageController overridables
         virtual void        initializePage() override;
commit a245e5c60fac58889738a9705225c6378b35eef4
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue May 8 12:42:55 2018 +0200

    loplugin:useuniqueptr in ORowSet
    
    hold this by rtl::Reference since we are taking references to it
    elsewhere and passing them around.
    
    Change-Id: Iae68d7da67cf84f01deb6bb42c00e4c74d7a99d7
    Reviewed-on: https://gerrit.libreoffice.org/54169
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 77abccbaf3e1..f7c7f95cdac5 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -135,7 +135,6 @@ ORowSet::ORowSet( const Reference< css::uno::XComponentContext >& _rxContext )
     ,m_aRowsetListeners(*m_pMutex)
     ,m_aApproveListeners(*m_pMutex)
     ,m_aRowsChangeListener(*m_pMutex)
-    ,m_pTables(nullptr)
     ,m_nFetchDirection(FetchDirection::FORWARD)
     ,m_nFetchSize(50)
     ,m_nMaxFieldSize(0)
@@ -2244,9 +2243,9 @@ Reference< XNameAccess > ORowSet::impl_getTables_throw()
     {
         xTables.set( xTablesAccess->getTables(), UNO_QUERY_THROW );
     }
-    else if ( m_pTables )
+    else if ( m_xTables )
     {
-        xTables = m_pTables;
+        xTables = m_xTables.get();
     }
     else
     {
@@ -2264,10 +2263,10 @@ Reference< XNameAccess > ORowSet::impl_getTables_throw()
             DBG_UNHANDLED_EXCEPTION("dbaccess");
         }
 
-        m_pTables = new OTableContainer(*this,m_aMutex,m_xActiveConnection,bCase,nullptr,nullptr,m_nInAppend);
-        xTables = m_pTables;
+        m_xTables = new OTableContainer(*this,m_aMutex,m_xActiveConnection,bCase,nullptr,nullptr,m_nInAppend);
+        xTables = m_xTables.get();
         Sequence<OUString> aTableFilter { "%" };
-        m_pTables->construct(aTableFilter,Sequence< OUString>());
+        m_xTables->construct(aTableFilter,Sequence< OUString>());
     }
 
     return xTables;
@@ -2275,19 +2274,19 @@ Reference< XNameAccess > ORowSet::impl_getTables_throw()
 
 void ORowSet::impl_resetTables_nothrow()
 {
-    if ( !m_pTables )
+    if ( !m_xTables )
         return;
 
     try
     {
-        m_pTables->dispose();
+        m_xTables->dispose();
     }
     catch( const Exception& )
     {
         DBG_UNHANDLED_EXCEPTION("dbaccess");
     }
 
-    DELETEZ( m_pTables );
+    m_xTables.clear();
 }
 
 void ORowSet::impl_initComposer_throw( OUString& _out_rCommandToExecute )
diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx
index a059f8f74420..6c66c159fc13 100644
--- a/dbaccess/source/core/api/RowSet.hxx
+++ b/dbaccess/source/core/api/RowSet.hxx
@@ -104,7 +104,7 @@ namespace dbaccess
 
         ::dbtools::WarningsContainer                m_aWarnings;
 
-        OTableContainer*                            m_pTables;
+        rtl::Reference<OTableContainer>        m_xTables;
 
         OUString                               m_aCommand;
         OUString                               m_aDataSourceName;
diff --git a/dbaccess/source/core/inc/tablecontainer.hxx b/dbaccess/source/core/inc/tablecontainer.hxx
index 36055e3e8a5e..0374f3e5121b 100644
--- a/dbaccess/source/core/inc/tablecontainer.hxx
+++ b/dbaccess/source/core/inc/tablecontainer.hxx
@@ -64,8 +64,6 @@ namespace dbaccess
 
         virtual void disposing() override;
 
-        virtual void SAL_CALL acquire() throw() override { OFilteredContainer::acquire();}
-        virtual void SAL_CALL release() throw() override { OFilteredContainer::release();}
     // css::lang::XServiceInfo
         DECLARE_SERVICE_INFO();
 
@@ -77,6 +75,9 @@ namespace dbaccess
         virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) override;
 
     public:
+        virtual void SAL_CALL acquire() throw() override { OFilteredContainer::acquire();}
+        virtual void SAL_CALL release() throw() override { OFilteredContainer::release();}
+
         /** ctor of the container. The parent has to support the <type scope="css::sdbc">XConnection</type>
             interface.<BR>
             @param          _rParent            the object which acts as parent for the container.


More information about the Libreoffice-commits mailing list