Tag: cws_src680_dba30
User: fs      
Date: 05/09/29 23:15:52

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

Log:
 RESYNC: (1.59-1.62); 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.2.2&r2=1.59.2.3
Delta lines:  +56 -57
---------------------
--- datasource.cxx      6 Apr 2005 09:53:33 -0000       1.59.2.2
+++ datasource.cxx      30 Sep 2005 06:15:47 -0000      1.59.2.3
@@ -1,22 +1,20 @@
 /*************************************************************************
  *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
  *  $RCSfile$
  *
  *  $Revision$
  *
  *  last change: $Author$ $Date$
  *
- *  The Contents of this file are made available subject to the terms of
- *  either of the following licenses
- *
- *         - GNU Lesser General Public License Version 2.1
- *         - Sun Industry Standards Source License Version 1.1
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
  *
- *  Sun Microsystems Inc., October, 2000
  *
  *  GNU Lesser General Public License Version 2.1
  *  =============================================
- *  Copyright 2000 by Sun Microsystems, Inc.
+ *    Copyright 2005 by Sun Microsystems, Inc.
  *  901 San Antonio Road, Palo Alto, CA 94303, USA
  *
  *  This library is free software; you can redistribute it and/or
@@ -33,30 +31,6 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  *  MA  02111-1307  USA
  *
- *
- *  Sun Industry Standards Source License Version 1.1
- *  =================================================
- *  The contents of this file are subject to the Sun Industry Standards
- *  Source License Version 1.1 (the "License"); You may not use this file
- *  except in compliance with the License. You may obtain a copy of the
- *  License at http://www.openoffice.org/license.html.
- *
- *  Software provided under this License is provided on an "AS IS" basis,
- *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- *  See the License for the specific provisions governing your rights and
- *  obligations concerning the Software.
- *
- *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
- *
- *  Copyright: 2000 by Sun Microsystems, Inc.
- *
- *  All Rights Reserved.
- *
- *  Contributor(s): _______________________________________
- *
- *
  ************************************************************************/
 
 #ifndef _DBA_COREDATAACCESS_DATASOURCE_HXX_
@@ -137,9 +111,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
@@ -155,6 +126,9 @@
 #ifndef _COM_SUN_STAR_EMBED_XTRANSACTEDOBJECT_HPP_
 #include <com/sun/star/embed/XTransactedObject.hpp>
 #endif
+#ifndef _COM_SUN_STAR_DOCUMENT_XDOCUMENTSUBSTORAGESUPPLIER_HPP_
+#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
+#endif
 
 #include <com/sun/star/document/XEventBroadcaster.hpp>
 #include <com/sun/star/view/XPrintable.hpp>
@@ -496,8 +470,7 @@
                                                aRet.push_back( 
*pDataSourceSetting );
                                        }
                                }
-
-                               return Sequence< PropertyValue 
>(aRet.begin(),aRet.size());
+                               return Sequence< PropertyValue 
>(&(*aRet.begin()),aRet.size());
                        }
                        return Sequence< PropertyValue >();
                }
@@ -742,8 +715,8 @@
                                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<css::embed::XTransactionListener> 
xEvt(m_pImpl->m_xModel,UNO_QUERY);
-                               aDriverInfo[nCount++].Value <<= 
m_pImpl->getStorage(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("database")),xEvt,ElementModes::READWRITE);
+                Reference< css::document::XDocumentSubStorageSupplier> 
xDocSup( m_pImpl->getDocumentSubStorageSupplier() );
+                               aDriverInfo[nCount++].Value <<= 
xDocSup->getDocumentSubStorage(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("database")),ElementModes::READWRITE);
                        }
                        if (nAdditionalArgs)
                                xReturn = 
xManager->getConnectionWithInfo(m_pImpl->m_sConnectURL, 
::comphelper::concatSequences(aUserPwd,aDriverInfo));
@@ -1229,7 +1202,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();
 
@@ -1269,10 +1242,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