User: obo     
Date: 05/07/08 03:36:01

Modified:
 /dba/dbaccess/source/core/dataaccess/
  databasecontext.cxx

Log:
 INTEGRATION: CWS dba20blocker (1.29.66); FILE MERGED
 2005/06/23 13:56:40 fs 1.29.66.1: copying fix for #i50905# into this CWS

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&r2=1.30
Delta lines:  +13 -9
--------------------
--- databasecontext.cxx 10 Mar 2005 16:33:20 -0000      1.29
+++ databasecontext.cxx 8 Jul 2005 10:35:59 -0000       1.30
@@ -282,9 +282,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();
 }
 
 //--------------------------------------------------------------------------
@@ -324,7 +323,6 @@
                )
        {
                OSL_ENSURE(aIter->second->m_refCount != 0,"Object is already 
disposed");
-               aIter->second->clear();
                aIter->second->dispose();               
        }
        m_aDatabaseObjects.clear();
@@ -421,16 +419,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);
@@ -520,7 +524,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;
        }
@@ -599,7 +603,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]

Reply via email to