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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Feb 3 15:09:55 UTC 2019


 dbaccess/source/core/api/RowSet.cxx     |   12 ++++--------
 dbaccess/source/core/api/RowSetBase.cxx |    3 +--
 dbaccess/source/core/api/RowSetBase.hxx |    2 +-
 3 files changed, 6 insertions(+), 11 deletions(-)

New commits:
commit 65f6a4088ad5d51a3225905aa6e2fa175f3eab49
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Feb 1 16:35:03 2019 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Sun Feb 3 16:09:32 2019 +0100

    dbaccess: convert ORowSetBase::m_pCache to shared_ptr
    
    Change-Id: Ic6f95a226e0d900fbc633796d7e27edcd13f5482
    Reviewed-on: https://gerrit.libreoffice.org/67286
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index dd5bd93d5e80..349d70716b7b 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -569,7 +569,7 @@ void ORowSet::freeResources( bool _bComplete )
         // let our warnings container forget the reference to the (possibly disposed) old result set
         m_aWarnings.setExternalWarnings( nullptr );
 
-        DELETEZ(m_pCache);
+        m_pCache.reset();
 
         impl_resetTables_nothrow();
 
@@ -1700,13 +1700,9 @@ Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw()
         aComposedUpdateTableName = composeTableName( m_xActiveConnection->getMetaData(), m_aUpdateCatalogName, m_aUpdateSchemaName, m_aUpdateTableName, false, ::dbtools::EComposeRule::InDataManipulation );
 
     SAL_INFO("dbaccess", "ORowSet::impl_prepareAndExecute_throw: creating cache" );
-    if(m_pCache)
-    {
-        DELETEZ(m_pCache);
-    }
-    m_pCache
-        = new ORowSetCache(xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName,
-                           m_bModified, m_bNew, *m_aParameterValueForCache, m_aFilter, m_nMaxRows);
+    m_pCache.reset(
+        new ORowSetCache(xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName,
+               m_bModified, m_bNew, *m_aParameterValueForCache, m_aFilter, m_nMaxRows));
     if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
     {
         m_nPrivileges = Privilege::SELECT;
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index 84d18d8aae34..94c7e9e7dd37 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -81,7 +81,6 @@ ORowSetBase::ORowSetBase( const Reference<XComponentContext>& _rContext, ::cppu:
     :OPropertyStateContainer(_rBHelper)
     ,m_pMutex(_pMutex)
     ,m_pMySelf(nullptr)
-    ,m_pCache(nullptr)
     ,m_rBHelper(_rBHelper)
     ,m_aContext( _rContext )
     ,m_nLastColumnIndex(-1)
@@ -793,7 +792,7 @@ bool SAL_CALL ORowSetBase::move(std::function<bool(ORowSetBase *)> const & _aChe
 
         bool bMoved = ( bWasNew || !_aCheckFunctor(this) );
 
-        bRet = _aMovementFunctor(m_pCache);
+        bRet = _aMovementFunctor(m_pCache.get());
         doCancelModification( );
 
         if ( bRet )
diff --git a/dbaccess/source/core/api/RowSetBase.hxx b/dbaccess/source/core/api/RowSetBase.hxx
index a6508b362952..af94d6da92ff 100644
--- a/dbaccess/source/core/api/RowSetBase.hxx
+++ b/dbaccess/source/core/api/RowSetBase.hxx
@@ -85,7 +85,7 @@ namespace dbaccess
         connectivity::ORowSetValue              m_aEmptyValue;      // only for error case
 
         ::cppu::OWeakObject*                    m_pMySelf;          // set by derived classes
-        ORowSetCache*                           m_pCache;           // the cache is used by the rowset and his clone (shared)
+        std::shared_ptr<ORowSetCache>           m_pCache;           // the cache is used by the rowset and his clone (shared)
         std::unique_ptr<ORowSetDataColumns>     m_pColumns;         // represent the select columns
         ::cppu::OBroadcastHelper&               m_rBHelper;         // must be set from the derived classes
         // is used when the formatkey for database types is set


More information about the Libreoffice-commits mailing list