From 85ef14318897f6e32c4987ab9d76c38a9752da24 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 23 Sep 2021 08:53:17 +0100 Subject: memory leak on loading dbase files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- dbaccess/source/core/api/RowSet.cxx | 4 ++-- dbaccess/source/core/api/RowSet.hxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'dbaccess/source') 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 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 m_xTables; + std::unique_ptr m_xTables; OUString m_aCommand; OUString m_aDataSourceName; -- cgit