Tag: cws_src680_dba30
User: fs      
Date: 06/03/21 10:23:38

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

Log:
 RESYNC: (1.9-1.11); FILE MERGED

File Changes:

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

File [changed]: ModelImpl.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/ModelImpl.cxx?r1=1.3.2.5&r2=1.3.2.6
Delta lines:  +43 -11
---------------------
--- ModelImpl.cxx       23 Nov 2005 10:14:40 -0000      1.3.2.5
+++ ModelImpl.cxx       21 Mar 2006 18:23:35 -0000      1.3.2.6
@@ -117,9 +117,6 @@
 #ifndef _DBA_CORE_CONNECTION_HXX_
 #include "connection.hxx"
 #endif
-#ifndef _COMPHELPER_GUARDING_HXX_
-#include <comphelper/guarding.hxx>
-#endif
 #ifndef _RTL_DIGEST_H_
 #include <rtl/digest.h>
 #endif
@@ -182,6 +179,33 @@
 {
 //........................................................................
 
+//========================================================================
+//= DocumentStorageAccess
+//========================================================================
+//------------------------------------------------------------------------
+SharedMutex::SharedMutex()
+    :m_refCount( 0 )
+{
+}
+
+//------------------------------------------------------------------------
+SharedMutex::~SharedMutex()
+{
+}
+
+//------------------------------------------------------------------------
+void SAL_CALL SharedMutex::acquire()
+{
+    osl_incrementInterlockedCount( &m_refCount );
+}
+
+//------------------------------------------------------------------------
+void SAL_CALL SharedMutex::release()
+{
+    if ( 0 == osl_decrementInterlockedCount( &m_refCount ) )
+        delete this;
+}
+
 //============================================================
 //= DocumentStorageAccess
 //============================================================
@@ -377,6 +401,7 @@
                        ,m_nLoginTimeout(0)
                        ,m_refCount(0)
             ,m_pStorageAccess( NULL )
+            ,m_xMutex( new SharedMutex )
 {
        // some kind of default
        DBG_CTOR(ODatabaseModelImpl,NULL);
@@ -407,6 +432,7 @@
                        ,m_nLoginTimeout(0)
                        ,m_refCount(0)
             ,m_pStorageAccess( NULL )
+            ,m_xMutex( new SharedMutex )
 {
        DBG_CTOR(ODatabaseModelImpl,NULL);
        // adjust our readonly flag
@@ -518,8 +544,11 @@
 
//------------------------------------------------------------------------------
 void ODatabaseModelImpl::clearConnections()
 {
+    OWeakConnectionArray aConnections;
+    aConnections.swap( m_aConnections );
+
        Reference< XConnection > xConn;
-       for (OWeakConnectionArray::iterator i = m_aConnections.begin(); 
m_aConnections.end() != i; ++i)
+       for ( OWeakConnectionArray::iterator i = aConnections.begin(); 
aConnections.end() != i; ++i )
        {
                xConn = *i;
                if ( xConn.is() )
@@ -534,7 +563,6 @@
                        }
                }
        }
-       m_aConnections.clear();
 
        m_pSharedConnectionManager = NULL;
        m_xSharedConnectionManager = NULL;
@@ -776,11 +804,7 @@
        {
                TStorages::iterator aFind = 
m_aStorages.find(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("database")));
                if ( aFind != m_aStorages.end() )
-               {
-                       Reference<XTransactedObject> 
xTrans(aFind->second,UNO_QUERY);
-                       if ( bStore = xTrans.is() )
-                               xTrans->commit();
-               }
+                       bStore = commitStorageIfWriteable(aFind->second);
        }
        catch(Exception&)
        {
@@ -919,6 +943,7 @@
         throw IOException();
     }
 }
+
 // 
-----------------------------------------------------------------------------
 const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings()
 {
@@ -971,6 +996,13 @@
         { NULL, Any() }
     };
     return aKnownSettings;
+}
+
+// 
-----------------------------------------------------------------------------
+ModelDependentComponent::ModelDependentComponent( const ::rtl::Reference< 
ODatabaseModelImpl >& _model )
+    :m_pImpl( _model )
+    ,m_xMutex( _model->getSharedMutex() )
+{
 }
 
 //........................................................................




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

Reply via email to