Tag: cws_src680_dba201 User: fs Date: 05/07/11 01:45:32 Modified: /dba/dbaccess/source/core/dataaccess/ databasecontext.cxx
Log: RESYNC: (1.29-1.30); FILE MERGED File Changes: Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: databasecontext.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/databasecontext.cxx?r1=1.29.28.2&r2=1.29.28.3 Delta lines: +13 -9 -------------------- --- databasecontext.cxx 9 May 2005 12:50:53 -0000 1.29.28.2 +++ databasecontext.cxx 11 Jul 2005 08:45:29 -0000 1.29.28.3 @@ -279,9 +279,8 @@ { ::rtl::Reference<ODatabaseModelImpl> pImpl(new ODatabaseModelImpl(m_xServiceManager)); pImpl->m_pDBContext = this; - Reference< XInterface > xRet = *(new ODatabaseSource(pImpl)); - pImpl->m_xDataSource = Reference<XDataSource>(xRet,UNO_QUERY); - return xRet; + Reference< XDataSource > xDataSource( pImpl->getDataSource() ); + return xDataSource.get(); } //-------------------------------------------------------------------------- @@ -321,7 +320,6 @@ ) { OSL_ENSURE(aIter->second->m_refCount != 0,"Object is already disposed"); - aIter->second->clear(); aIter->second->dispose(); } m_aDatabaseObjects.clear(); @@ -418,16 +416,22 @@ if ( !xExistent.is() ) { ::rtl::Reference<ODatabaseModelImpl> pImpl(new ODatabaseModelImpl(_rName,m_xServiceManager,this)); - xExistent = *(new ODatabaseSource(pImpl)); - pImpl->m_xDataSource = Reference<XDataSource>(xExistent,UNO_QUERY); + xExistent = pImpl->getDataSource().get(); Sequence< PropertyValue > aArgs(1); aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FileName")); aArgs[0].Value <<= _sURL; - Reference<XModel> xModel = new ODatabaseDocument(pImpl); + Reference<XModel> xModel = pImpl->createNewModel_deliverOwnership(); + DBG_ASSERT( xModel.is(), "ODatabaseContext::loadObjectFromURL: no model?" ); // calls registerPrivate in attachResource xModel->attachResource(_sURL,aArgs); + + // since the model has been newly created, we're its owner. However, we do not + // really need it, we ust used it for loading the document. So, dispose it to prevent + // leaks + // #i50905# / 2005-06-20 / [EMAIL PROTECTED] + ::comphelper::disposeComponent( xModel ); } setTransientProperties(_sURL,xExistent); @@ -517,7 +521,7 @@ ++aLookup ) { - Reference< XInterface > xDataSource(aLookup->second->m_xDataSource.get(), UNO_QUERY); + Reference< XInterface > xDataSource(aLookup->second->getDataSource(false), UNO_QUERY); if ( xDataSource == xSource ) break; } @@ -596,7 +600,7 @@ ObjectCacheIterator aExistent = m_aDatabaseObjects.find(sURL); if ( aExistent != m_aDatabaseObjects.end() ) { - xExistent = aExistent->second->m_xDataSource; + xExistent = aExistent->second->getDataSource(false); if (xExistent.is()) { Reference< XComponent > xComponent(xExistent, UNO_QUERY); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
