Kaydet (Commit) ac0e973f authored tarafından Michael Stahl's avatar Michael Stahl Kaydeden (comit) Andras Timar

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 2660d24a)

(cherry picked from commit 96ae2a33)

tdf#114596 compilerplugins: add exception to [loplugin:refcounting]
(cherry picked from commit e80da608)

Change-Id: I4cad01dc9cdaf405c1eb31d6c0e161eb6712b78f
Reviewed-on: https://gerrit.libreoffice.org/49026Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Tested-by: 's avatarMichael Stahl <mstahl@redhat.com>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
(cherry picked from commit b5440ce2)
üst 8e4d18d6
......@@ -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);
......
......@@ -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( ) throw (RuntimeException, std::exception)
{
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( ) throw(RuntimeException, std::exception)
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment