Tag: cws_src680_dba201
User: fs      
Date: 05/07/11 01:46:01

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

Log:
 RESYNC: (1.59-1.60); FILE MERGED

File Changes:

Directory: /dba/dbaccess/source/core/dataaccess/
================================================

File [changed]: datasource.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/datasource.cxx?r1=1.59.20.2&r2=1.59.20.3
Delta lines:  +57 -34
---------------------
--- datasource.cxx      9 May 2005 12:50:55 -0000       1.59.20.2
+++ datasource.cxx      11 Jul 2005 08:45:58 -0000      1.59.20.3
@@ -125,9 +125,6 @@
 #ifndef _COMPHELPER_INTERACTION_HXX_
 #include <comphelper/interaction.hxx>
 #endif
-#ifndef DBA_COREDATAACCESS_COMMITLISTENER_HXX
-#include "commitlistener.hxx"
-#endif
 #ifndef _DBA_CORE_CONNECTION_HXX_
 #include "connection.hxx"
 #endif
@@ -740,7 +737,7 @@
                                aDriverInfo[nCount].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL"));
                                aDriverInfo[nCount++].Value <<= 
m_pImpl->getURL();
                                aDriverInfo[nCount].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Storage"));
-                Reference< 
::com::sun::star::document::XDocumentSubStorageSupplier> 
xDocSup(m_pImpl->m_xModel,UNO_QUERY_THROW);
+                Reference< css::document::XDocumentSubStorageSupplier> 
xDocSup( m_pImpl->getDocumentSubStorageSupplier() );
                                aDriverInfo[nCount++].Value <<= 
xDocSup->getDocumentSubStorage(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("database")),ElementModes::READWRITE);
                        }
                        if (nAdditionalArgs)
@@ -1198,7 +1195,7 @@
        {
                ResettableMutexGuard _rGuard(m_aMutex);
                
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
-        Reference< css::frame::XStorable> 
xStorable(m_pImpl->getModel(),UNO_QUERY);
+        Reference< css::frame::XStorable> 
xStorable(getModelWithPossibleLeak(),UNO_QUERY);
         if ( xStorable.is() )
             xStorable->store();
                
@@ -1238,10 +1235,36 @@
                m_pImpl->setModified(sal_True);
 }
 // 
-----------------------------------------------------------------------------
+Reference< XModel > ODatabaseSource::getModelWithPossibleLeak()
+{
+    Reference< XModel > xModel;
+    if ( m_pImpl.is() )
+    {
+        xModel = m_pImpl->getModel_noCreate();
+        if ( !xModel.is() )
+        {
+            // In the course of #i50905#, the ownership of a XModel instance 
was more clearly
+            // defined and respected throughout all involved implementations. 
This place
+            // here is the last one where a fix wasn't easily possible within 
the restrictions
+            // which applied to the fix (time frame, risk)
+            //
+            // There's a pretty large comment in 
ODatabaseDocument::disconnectController
+            // explaining how this dilemma could be solved (which in fact 
suggests to
+            // get completely rid of the "sole ownership" concept, and replace 
it with
+            // shared ownership, and vetoable closing).
+            //
+            // #i50905# / 2005-06-20 / [EMAIL PROTECTED]
+            DBG_ERROR( "ODatabaseSource::getModelWithPossibleLeak: creating a 
model instance with undefined ownership! Probably a resource leak!" );
+            xModel = m_pImpl->createNewModel_deliverOwnership();
+        }
+    }
+    return xModel;
+}
+// 
-----------------------------------------------------------------------------
 // XDocumentDataSource
-Reference< ::com::sun::star::sdb::XOfficeDatabaseDocument > SAL_CALL 
ODatabaseSource::getDatabaseDocument() throw (RuntimeException)
+Reference< XOfficeDatabaseDocument > SAL_CALL 
ODatabaseSource::getDatabaseDocument() throw (RuntimeException)
 {
-       return m_pImpl.is() ? Reference< 
::com::sun::star::sdb::XOfficeDatabaseDocument >(m_pImpl->getModel(),UNO_QUERY) 
: Reference< ::com::sun::star::sdb::XOfficeDatabaseDocument >();
+    return Reference< XOfficeDatabaseDocument >( getModelWithPossibleLeak(), 
UNO_QUERY );
 }
 // 
-----------------------------------------------------------------------------
 //........................................................................




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to