summaryrefslogtreecommitdiff
path: root/dbaccess/source
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2018-01-31 14:34:31 +0100
committerMichael Stahl <mstahl@redhat.com>2018-01-31 14:38:53 +0100
commit96ae2a3300811897c24cccb20f8c2faf382483df (patch)
tree59af0f2f023a526dea31a13b10f1487c7fbb961d /dbaccess/source
parent271c35f1f7894f662231108ab9a1961ee4e87f64 (diff)
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) Change-Id: I4cad01dc9cdaf405c1eb31d6c0e161eb6712b78f
Diffstat (limited to 'dbaccess/source')
-rw-r--r--dbaccess/source/core/dataaccess/datasource.cxx5
-rw-r--r--dbaccess/source/core/dataaccess/datasource.hxx3
2 files changed, 5 insertions, 3 deletions
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index cab756146286..9bd5d7e7afc7 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -475,7 +475,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
@@ -1179,7 +1179,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 7d6401922271..14328e19c34f 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: