summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-05-29 13:18:37 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2019-05-31 10:19:21 +0200
commit6bd751f9f577f25b058fb8a5479c0de7552c3ffc (patch)
tree56599da4cd740d638cc17c1aeb7a134a96a2b47a
parent36cee080555c759443896cb3b34c3f710f33e0f0 (diff)
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@cib.de>
-rw-r--r--connectivity/source/commontools/TIndex.cxx4
-rw-r--r--connectivity/source/commontools/TKey.cxx2
-rw-r--r--connectivity/source/drivers/ado/AGroup.cxx2
-rw-r--r--connectivity/source/drivers/ado/AIndex.cxx2
-rw-r--r--connectivity/source/drivers/ado/AKey.cxx2
-rw-r--r--connectivity/source/drivers/ado/AUser.cxx2
-rw-r--r--connectivity/source/drivers/dbase/DIndex.cxx2
-rw-r--r--include/connectivity/sdbcx/VGroup.hxx3
-rw-r--r--include/connectivity/sdbcx/VIndex.hxx3
-rw-r--r--include/connectivity/sdbcx/VKey.hxx3
-rw-r--r--include/connectivity/sdbcx/VUser.hxx3
11 files changed, 16 insertions, 12 deletions
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 f1c0b2194d09..c5c74e809f79 100644
--- a/connectivity/source/drivers/dbase/DIndex.cxx
+++ b/connectivity/source/drivers/dbase/DIndex.cxx
@@ -101,7 +101,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 ead9a500c6b9..f393c421e33b 100644
--- a/include/connectivity/sdbcx/VGroup.hxx
+++ b/include/connectivity/sdbcx/VGroup.hxx
@@ -51,7 +51,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 b4360f7e0805..ecfced63e18a 100644
--- a/include/connectivity/sdbcx/VIndex.hxx
+++ b/include/connectivity/sdbcx/VIndex.hxx
@@ -53,7 +53,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 6bc6b7df2ecb..f6a04edcf773 100644
--- a/include/connectivity/sdbcx/VKey.hxx
+++ b/include/connectivity/sdbcx/VKey.hxx
@@ -68,7 +68,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 ef488b074ac7..a407a063f0d7 100644
--- a/include/connectivity/sdbcx/VUser.hxx
+++ b/include/connectivity/sdbcx/VUser.hxx
@@ -51,7 +51,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;