[Libreoffice-commits] .: ucb/source

Caolán McNamara caolan at kemper.freedesktop.org
Mon Oct 11 06:43:50 PDT 2010


 ucb/source/core/ucbstore.cxx |   39 ++++++++-------------------------------
 ucb/source/core/ucbstore.hxx |    6 ++----
 2 files changed, 10 insertions(+), 35 deletions(-)

New commits:
commit 45b95fddcae6f39b05f339726e364196c4a591b3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 11 12:40:39 2010 +0100

    #i112747# fix ownership cycle in ucb

diff --git a/ucb/source/core/ucbstore.cxx b/ucb/source/core/ucbstore.cxx
index 7bf58a2..fa0e2a1 100644
--- a/ucb/source/core/ucbstore.cxx
+++ b/ucb/source/core/ucbstore.cxx
@@ -274,8 +274,9 @@ UcbStore::createPropertySetRegistry( const OUString& )
     {
         osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
         if ( !m_pImpl->m_xTheRegistry.is() )
-            m_pImpl->m_xTheRegistry = new PropertySetRegistry( m_xSMgr, *this );
+            m_pImpl->m_xTheRegistry = new PropertySetRegistry( m_xSMgr, getInitArgs() );
     }
+
     return m_pImpl->m_xTheRegistry;
 }
 
@@ -294,22 +295,6 @@ void SAL_CALL UcbStore::initialize( const Sequence< Any >& aArguments )
 }
 
 //=========================================================================
-//
-// New methods.
-//
-//=========================================================================
-
-void UcbStore::removeRegistry()
-{
-    if ( m_pImpl->m_xTheRegistry.is() )
-    {
-        osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
-        if ( m_pImpl->m_xTheRegistry.is() )
-            m_pImpl->m_xTheRegistry = 0;
-    }
-}
-
-//=========================================================================
 const Sequence< Any >& UcbStore::getInitArgs() const
 {
     return m_pImpl->m_aInitArgs;
@@ -323,7 +308,7 @@ const Sequence< Any >& UcbStore::getInitArgs() const
 
 struct PropertySetRegistry_Impl
 {
-    UcbStore*  						  m_pCreator;
+    const Sequence< Any >			  m_aInitArgs;
     PropertySetMap_Impl 			  m_aPropSets;
     Reference< XMultiServiceFactory > m_xConfigProvider;
     Reference< XInterface >			  m_xRootReadAccess;
@@ -332,18 +317,11 @@ struct PropertySetRegistry_Impl
     sal_Bool			  			  m_bTriedToGetRootReadAccess;  // #82494#
     sal_Bool			  			  m_bTriedToGetRootWriteAccess; // #82494#
 
-    PropertySetRegistry_Impl( UcbStore& rCreator )
-    : m_pCreator( &rCreator ),
+    PropertySetRegistry_Impl( const Sequence< Any > &rInitArgs )
+        : m_aInitArgs( rInitArgs ),
       m_bTriedToGetRootReadAccess( sal_False ),
       m_bTriedToGetRootWriteAccess( sal_False )
     {
-        m_pCreator->acquire();
-    }
-
-    ~PropertySetRegistry_Impl()
-    {
-        m_pCreator->removeRegistry();
-        m_pCreator->release();
     }
 };
 
@@ -359,9 +337,9 @@ struct PropertySetRegistry_Impl
 
 PropertySetRegistry::PropertySetRegistry(
                         const Reference< XMultiServiceFactory >& rXSMgr,
-                        UcbStore& rCreator )
+                        const Sequence< Any > &rInitArgs )
 : m_xSMgr( rXSMgr ),
-  m_pImpl( new PropertySetRegistry_Impl( rCreator ) )
+  m_pImpl( new PropertySetRegistry_Impl( rInitArgs ) )
 {
 }
 
@@ -1094,8 +1072,7 @@ Reference< XMultiServiceFactory > PropertySetRegistry::getConfigProvider()
         osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
         if ( !m_pImpl->m_xConfigProvider.is() )
         {
-            const Sequence< Any >& rInitArgs
-                = m_pImpl->m_pCreator->getInitArgs();
+            const Sequence< Any >& rInitArgs = m_pImpl->m_aInitArgs;
 
             if ( rInitArgs.getLength() > 0 )
             {
diff --git a/ucb/source/core/ucbstore.hxx b/ucb/source/core/ucbstore.hxx
index a28a016..dd086f3 100644
--- a/ucb/source/core/ucbstore.hxx
+++ b/ucb/source/core/ucbstore.hxx
@@ -93,9 +93,6 @@ public:
         throw( ::com::sun::star::uno::Exception,
                ::com::sun::star::uno::RuntimeException );
 
-    // New
-    void removeRegistry();
-
     const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >&
     getInitArgs() const;
 };
@@ -132,7 +129,8 @@ public:
     PropertySetRegistry(
         const com::sun::star::uno::Reference<
                 com::sun::star::lang::XMultiServiceFactory >& rXSMgr,
-        UcbStore& rCreator );
+                const ::com::sun::star::uno::Sequence<
+                                                ::com::sun::star::uno::Any >& rInitArgs);
     virtual ~PropertySetRegistry();
 
     // XInterface


More information about the Libreoffice-commits mailing list