compilerplugins/clang/refcounting.cxx | 4 ++++ dbaccess/source/core/dataaccess/datasource.cxx | 5 +++-- dbaccess/source/core/dataaccess/datasource.hxx | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-)
New commits: commit b5440ce23b17d84f7971cb7ea35512d5cac69c9f Author: Michael Stahl <mst...@redhat.com> Date: Wed Jan 31 14:34:31 2018 +0100 tdf#114596 dbaccess: fix mysterious dataloss bug OBookmarkContainer actually re-uses the reference count of ODatabaseSource, so converting ODatabaseSource::m_aBookmark to Reference created a cycle, which somehow causes the dataloss, because evidently something as important as storing the data must be done in the destructor. (regression from 2660d24a07866e083c5135ea263030f3e3a2e729) (cherry picked from commit 96ae2a3300811897c24cccb20f8c2faf382483df) tdf#114596 compilerplugins: add exception to [loplugin:refcounting] (cherry picked from commit e80da60895b45309fa1d018760d5f11cca4367f4) Change-Id: I4cad01dc9cdaf405c1eb31d6c0e161eb6712b78f Reviewed-on: https://gerrit.libreoffice.org/49026 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Michael Stahl <mst...@redhat.com> Reviewed-by: Michael Stahl <mst...@redhat.com> diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx index e008a9e501dd..5a4a40a37d3c 100644 --- a/compilerplugins/clang/refcounting.cxx +++ b/compilerplugins/clang/refcounting.cxx @@ -146,6 +146,10 @@ bool containsXInterfaceSubclass(const Type* pType0) { if (isDerivedFrom(pRecordDecl, "XPropertyList")) { // module svx return false; } + // tdf#114596 + if (isDerivedFrom(pRecordDecl, "dbaccess::OBookmarkContainer")) { // module dbaccess + return false; + } } if (pRecordDecl) { const ClassTemplateSpecializationDecl* pTemplate = dyn_cast<ClassTemplateSpecializationDecl>(pRecordDecl); diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index c56f67b90f18..cf6ab3c45a55 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -472,7 +472,7 @@ ODatabaseSource::ODatabaseSource(const ::rtl::Reference<ODatabaseModelImpl>& _pI :ModelDependentComponent( _pImpl ) ,ODatabaseSource_Base( getMutex() ) ,OPropertySetHelper( ODatabaseSource_Base::rBHelper ) - ,m_xBookmarks( new OBookmarkContainer( *this, getMutex() ) ) + , m_Bookmarks(*this, getMutex()) ,m_aFlushListeners( getMutex() ) { // some kind of default @@ -1162,7 +1162,8 @@ Reference< XConnection > ODatabaseSource::getConnection(const OUString& user, co Reference< XNameAccess > SAL_CALL ODatabaseSource::getBookmarks( ) { ModelMethodGuard aGuard( *this ); - return static_cast< XNameContainer* >(m_xBookmarks.get()); + // tdf#114596 this may look nutty but see OBookmarkContainer::aquire() + return static_cast<XNameContainer*>(&m_Bookmarks); } Reference< XNameAccess > SAL_CALL ODatabaseSource::getQueryDefinitions( ) diff --git a/dbaccess/source/core/dataaccess/datasource.hxx b/dbaccess/source/core/dataaccess/datasource.hxx index b508c599b2b3..7c6e18b8b90f 100644 --- a/dbaccess/source/core/dataaccess/datasource.hxx +++ b/dbaccess/source/core/dataaccess/datasource.hxx @@ -82,7 +82,8 @@ class ODatabaseSource :public ModelDependentComponent // must be first private: using ODatabaseSource_Base::rBHelper; - rtl::Reference<OBookmarkContainer> m_xBookmarks; + // note: this thing uses the ref-count of "this", see OBookmarkContainer::acquire! + OBookmarkContainer m_Bookmarks; ::comphelper::OInterfaceContainerHelper2 m_aFlushListeners; private: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits