diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-09-23 08:53:17 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-09-23 13:46:33 +0200 |
commit | 85ef14318897f6e32c4987ab9d76c38a9752da24 (patch) | |
tree | 43b5e4e30086fe7bb17a31177dffcd9750769fd5 /dbaccess/source | |
parent | 238b6cf0ff0d66d57bea9e8dc38d93caf4563124 (diff) |
memory leak on loading dbase files
see on loading qadevOOo/testdocs/BasicDB/DBTest.dbf
a problem apparently since...
commit a245e5c60fac58889738a9705225c6378b35eef4
Date: Tue May 8 12:42:55 2018 +0200
loplugin:useuniqueptr in ORowSet
OTableContainer inherits from OCollection which has a unique and
nonstandard acquire/release which forwards to a parent
cppu::OWeakObject. So when it would appear to a casual observer, who
assumes that it has an internal refcount, that its refcount would drop
to zero and then get auto-deleted, nothing of the kind occurs.
Change-Id: Ib104415ccc13c6ed9c06f975857fcd4413e2e05d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122519
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess/source')
-rw-r--r-- | dbaccess/source/core/api/RowSet.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/core/api/RowSet.hxx | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index fb10287e9d3f..79ffe82ea2da 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -2227,7 +2227,7 @@ Reference< XNameAccess > ORowSet::impl_getTables_throw() DBG_UNHANDLED_EXCEPTION("dbaccess"); } - m_xTables = new OTableContainer(*this,m_aMutex,m_xActiveConnection,bCase,nullptr,nullptr,m_nInAppend); + m_xTables.reset(new OTableContainer(*this,m_aMutex,m_xActiveConnection,bCase,nullptr,nullptr,m_nInAppend)); xTables = m_xTables.get(); Sequence<OUString> aTableFilter { "%" }; m_xTables->construct(aTableFilter,Sequence< OUString>()); @@ -2250,7 +2250,7 @@ void ORowSet::impl_resetTables_nothrow() DBG_UNHANDLED_EXCEPTION("dbaccess"); } - m_xTables.clear(); + m_xTables.reset(); } 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 a7d06a7a6567..33a1aceaa4c5 100644 --- a/dbaccess/source/core/api/RowSet.hxx +++ b/dbaccess/source/core/api/RowSet.hxx @@ -100,7 +100,7 @@ namespace dbaccess ::dbtools::WarningsContainer m_aWarnings; - rtl::Reference<OTableContainer> m_xTables; + std::unique_ptr<OTableContainer> m_xTables; OUString m_aCommand; OUString m_aDataSourceName; |