[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - connectivity/source include/connectivity

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Fri May 31 16:07:48 UTC 2019


 connectivity/source/commontools/TIndex.cxx   |    4 ++--
 connectivity/source/commontools/TKey.cxx     |    2 +-
 connectivity/source/drivers/ado/AGroup.cxx   |    2 +-
 connectivity/source/drivers/ado/AIndex.cxx   |    2 +-
 connectivity/source/drivers/ado/AKey.cxx     |    2 +-
 connectivity/source/drivers/ado/AUser.cxx    |    2 +-
 connectivity/source/drivers/dbase/DIndex.cxx |    2 +-
 include/connectivity/sdbcx/VGroup.hxx        |    3 ++-
 include/connectivity/sdbcx/VIndex.hxx        |    3 ++-
 include/connectivity/sdbcx/VKey.hxx          |    3 ++-
 include/connectivity/sdbcx/VUser.hxx         |    3 ++-
 11 files changed, 16 insertions(+), 12 deletions(-)

New commits:
commit 7bd559972069055e0df726993a018f9b4d129221
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed May 29 13:18:37 2019 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Fri May 31 18:07:08 2019 +0200

    connectivity: fix memory leaks caused by OConnection::acquire()
    
    Followup to 58f121ef2e680697e10453add43bab9b771d153a;
    OConnection must not be held by rtl::Reference as that creates a cycle.
    
    (regression from 497e40ad03c27837978551ba15491c3fb2a0bf53)
    
    Change-Id: Ibd56d335e3e2631c5a57ea435f1035e89868a5a6
    Reviewed-on: https://gerrit.libreoffice.org/73155
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit 6bd751f9f577f25b058fb8a5479c0de7552c3ffc)
    Reviewed-on: https://gerrit.libreoffice.org/73243
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/connectivity/source/commontools/TIndex.cxx b/connectivity/source/commontools/TIndex.cxx
index 2b5be27e337a..cba83f780137 100644
--- a/connectivity/source/commontools/TIndex.cxx
+++ b/connectivity/source/commontools/TIndex.cxx
@@ -37,7 +37,7 @@ OIndexHelper::OIndexHelper( OTableHelper* _pTable) : connectivity::sdbcx::OIndex
 {
     construct();
     std::vector< OUString> aVector;
-    m_pColumns = new OIndexColumns(this,m_aMutex,aVector);
+    m_pColumns.reset(new OIndexColumns(this,m_aMutex,aVector));
 }
 
 OIndexHelper::OIndexHelper( OTableHelper* _pTable,
@@ -93,7 +93,7 @@ void OIndexHelper::refreshColumns()
     if(m_pColumns)
         m_pColumns->reFill(aVector);
     else
-        m_pColumns = new OIndexColumns(this,m_aMutex,aVector);
+        m_pColumns.reset(new OIndexColumns(this,m_aMutex,aVector));
 }
 
 
diff --git a/connectivity/source/commontools/TKey.cxx b/connectivity/source/commontools/TKey.cxx
index 7720adcc0a19..16910f558ef4 100644
--- a/connectivity/source/commontools/TKey.cxx
+++ b/connectivity/source/commontools/TKey.cxx
@@ -100,7 +100,7 @@ void OTableKeyHelper::refreshColumns()
     if ( m_pColumns )
         m_pColumns->reFill(aVector);
     else
-        m_pColumns = new OKeyColumnsHelper(this,m_aMutex,aVector);
+        m_pColumns.reset(new OKeyColumnsHelper(this,m_aMutex,aVector));
 }
 
 
diff --git a/connectivity/source/drivers/ado/AGroup.cxx b/connectivity/source/drivers/ado/AGroup.cxx
index e0c8b49a2d01..0b251a6f2cf3 100644
--- a/connectivity/source/drivers/ado/AGroup.cxx
+++ b/connectivity/source/drivers/ado/AGroup.cxx
@@ -78,7 +78,7 @@ void OAdoGroup::refreshUsers()
     if(m_pUsers)
         m_pUsers->reFill(aVector);
     else
-        m_pUsers = new OUsers(m_pCatalog,m_aMutex,aVector,aUsers,isCaseSensitive());
+        m_pUsers.reset(new OUsers(m_pCatalog, m_aMutex, aVector, aUsers, isCaseSensitive()));
 }
 
 Sequence< sal_Int8 > OAdoGroup::getUnoTunnelImplementationId()
diff --git a/connectivity/source/drivers/ado/AIndex.cxx b/connectivity/source/drivers/ado/AIndex.cxx
index 29ecf4d4d74b..0888fa1bf2b8 100644
--- a/connectivity/source/drivers/ado/AIndex.cxx
+++ b/connectivity/source/drivers/ado/AIndex.cxx
@@ -66,7 +66,7 @@ void OAdoIndex::refreshColumns()
     if ( m_pColumns )
         m_pColumns->reFill(aVector);
     else
-        m_pColumns = new OColumns(*this,m_aMutex,aVector,aColumns,isCaseSensitive(),m_pConnection);
+        m_pColumns.reset(new OColumns(*this, m_aMutex, aVector, aColumns, isCaseSensitive(), m_pConnection));
 }
 
 
diff --git a/connectivity/source/drivers/ado/AKey.cxx b/connectivity/source/drivers/ado/AKey.cxx
index 4393666d40be..25ffeb6eece6 100644
--- a/connectivity/source/drivers/ado/AKey.cxx
+++ b/connectivity/source/drivers/ado/AKey.cxx
@@ -63,7 +63,7 @@ void OAdoKey::refreshColumns()
     if(m_pColumns)
         m_pColumns->reFill(aVector);
     else
-        m_pColumns = new OColumns(*this,m_aMutex,aVector,aColumns,isCaseSensitive(),m_pConnection);
+        m_pColumns.reset(new OColumns(*this, m_aMutex, aVector, aColumns, isCaseSensitive(), m_pConnection));
 }
 
 Sequence< sal_Int8 > OAdoKey::getUnoTunnelImplementationId()
diff --git a/connectivity/source/drivers/ado/AUser.cxx b/connectivity/source/drivers/ado/AUser.cxx
index cff7695c757d..4e595de36bac 100644
--- a/connectivity/source/drivers/ado/AUser.cxx
+++ b/connectivity/source/drivers/ado/AUser.cxx
@@ -62,7 +62,7 @@ void OAdoUser::refreshGroups()
     if(m_pGroups)
         m_pGroups->reFill(aVector);
     else
-        m_pGroups = new OGroups(m_pCatalog,m_aMutex,aVector,aGroups,isCaseSensitive());
+        m_pGroups.reset(new OGroups(m_pCatalog, m_aMutex, aVector, aGroups, isCaseSensitive()));
 }
 
 Sequence< sal_Int8 > OAdoUser::getUnoTunnelImplementationId()
diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx
index 70e9eed51335..0e640865d700 100644
--- a/connectivity/source/drivers/dbase/DIndex.cxx
+++ b/connectivity/source/drivers/dbase/DIndex.cxx
@@ -100,7 +100,7 @@ void ODbaseIndex::refreshColumns()
     if(m_pColumns)
         m_pColumns->reFill(aVector);
     else
-        m_pColumns = new ODbaseIndexColumns(this,m_aMutex,aVector);
+        m_pColumns.reset(new ODbaseIndexColumns(this,m_aMutex,aVector));
 }
 
 Sequence< sal_Int8 > ODbaseIndex::getUnoTunnelImplementationId()
diff --git a/include/connectivity/sdbcx/VGroup.hxx b/include/connectivity/sdbcx/VGroup.hxx
index 61722d234e2f..dfff84dedb39 100644
--- a/include/connectivity/sdbcx/VGroup.hxx
+++ b/include/connectivity/sdbcx/VGroup.hxx
@@ -55,7 +55,8 @@ namespace connectivity
                         public ODescriptor
         {
         protected:
-            rtl::Reference<OUsers>    m_pUsers;
+            // no Reference! see OCollection::acquire
+            std::unique_ptr<OUsers> m_pUsers;
 
             using OGroup_BASE::rBHelper;
 
diff --git a/include/connectivity/sdbcx/VIndex.hxx b/include/connectivity/sdbcx/VIndex.hxx
index 6cd36f02861f..7ffc269cf4e7 100644
--- a/include/connectivity/sdbcx/VIndex.hxx
+++ b/include/connectivity/sdbcx/VIndex.hxx
@@ -57,7 +57,8 @@ namespace connectivity
             bool            m_IsPrimaryKeyIndex;
             bool            m_IsClustered;
 
-            rtl::Reference<OCollection>    m_pColumns;
+            // no Reference! see OCollection::acquire
+            std::unique_ptr<OCollection> m_pColumns;
 
             using ODescriptor_BASE::rBHelper;
             virtual void refreshColumns() override;
diff --git a/include/connectivity/sdbcx/VKey.hxx b/include/connectivity/sdbcx/VKey.hxx
index bafab2761015..d786fb00c74a 100644
--- a/include/connectivity/sdbcx/VKey.hxx
+++ b/include/connectivity/sdbcx/VKey.hxx
@@ -69,7 +69,8 @@ namespace connectivity
         {
         protected:
             std::shared_ptr<KeyProperties>   m_aProps;
-            rtl::Reference<OCollection>      m_pColumns;
+            // no Reference! see OCollection::acquire
+            std::unique_ptr<OCollection> m_pColumns;
 
             using ODescriptor_BASE::rBHelper;
             // OPropertyArrayUsageHelper
diff --git a/include/connectivity/sdbcx/VUser.hxx b/include/connectivity/sdbcx/VUser.hxx
index 2727f167a029..c30875df873f 100644
--- a/include/connectivity/sdbcx/VUser.hxx
+++ b/include/connectivity/sdbcx/VUser.hxx
@@ -53,7 +53,8 @@ namespace connectivity
                         public ODescriptor
         {
         protected:
-            rtl::Reference<OGroups>  m_pGroups;
+            // no Reference! see OCollection::acquire
+            std::unique_ptr<OGroups> m_pGroups;
 
             using OUser_BASE::rBHelper;
 


More information about the Libreoffice-commits mailing list