Kaydet (Commit) 96ae2a33 authored tarafından Michael Stahl's avatar Michael Stahl

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)

Change-Id: I4cad01dc9cdaf405c1eb31d6c0e161eb6712b78f
üst 271c35f1
......@@ -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( )
......
......@@ -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