ucb/source/ucp/file/bc.cxx     |    4 ++--
 ucb/source/ucp/file/bc.hxx     |   14 ++++++--------
 ucb/source/ucp/file/filnot.cxx |    7 ++-----
 ucb/source/ucp/file/prov.cxx   |    4 +---
 4 files changed, 11 insertions(+), 18 deletions(-)

New commits:
commit c3c337c9506ab9b908f2f91983bb3ee4caa26b3f
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sat Nov 16 21:09:32 2024 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sun Nov 17 15:41:22 2024 +0100

    create BaseContent with the state required and drop mutex
    
    and ContentEventNotifier can be de-friended
    
    Holding this mutex to write to a just created local doesn't make sense
    to me. I can't see any where that there might be another thread that
    matters here.
    
    Change-Id: I803a45a0cf02ebc306767595555018ee97d96caf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176684
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx
index e9114142b96f..b813882b33af 100644
--- a/ucb/source/ucp/file/bc.cxx
+++ b/ucb/source/ucp/file/bc.cxx
@@ -125,12 +125,12 @@ BaseContent::BaseContent( TaskManager* pMyShell,
 
 BaseContent::BaseContent( TaskManager* pMyShell,
                           const Reference< XContentIdentifier >& 
xContentIdentifier,
-                          OUString aUncPath )
+                          OUString aUncPath, sal_uInt16 nState )
     : m_pMyShell( pMyShell ),
       m_xContentIdentifier( xContentIdentifier ),
       m_aUncPath(std::move( aUncPath )),
       m_bFolder( false ),
-      m_nState( FullFeatured )
+      m_nState( nState )
 {
     m_pMyShell->m_pProvider->acquire();
     m_pMyShell->registerNotifier( m_aUncPath,this );
diff --git a/ucb/source/ucp/file/bc.hxx b/ucb/source/ucp/file/bc.hxx
index ca1f045fb582..dde84a314844 100644
--- a/ucb/source/ucp/file/bc.hxx
+++ b/ucb/source/ucp/file/bc.hxx
@@ -72,10 +72,15 @@ namespace fileaccess {
                      bool bFolder );
 
     public:
+        enum state { NameForInsertionSet = 1,
+                     JustInserted = 2,
+                     Deleted = 4,
+                     FullFeatured = 8 };
+
         BaseContent(
             TaskManager* pMyShell,
             const css::uno::Reference< css::ucb::XContentIdentifier >& 
xContentIdentifier,
-            OUString aUnqPath );
+            OUString aUnqPath, sal_uInt16 nState = FullFeatured);
 
         virtual ~BaseContent() override;
 
@@ -195,11 +200,6 @@ namespace fileaccess {
         TaskManager*                                                m_pMyShell;
         css::uno::Reference< css::ucb::XContentIdentifier >   
m_xContentIdentifier;
         OUString                                              m_aUncPath;
-
-        enum state { NameForInsertionSet = 1,
-                     JustInserted = 2,
-                     Deleted = 4,
-                     FullFeatured = 8 };
         bool                                                  m_bFolder;
         sal_uInt16                                            m_nState;
 
@@ -248,8 +248,6 @@ namespace fileaccess {
                 const css::ucb::InsertCommandArgument& aInsertArgument );
 
         void endTask( sal_Int32 CommandId );
-
-        friend class ContentEventNotifier;
     };
 
 }             // end namespace fileaccess
diff --git a/ucb/source/ucp/file/filnot.cxx b/ucb/source/ucp/file/filnot.cxx
index db8309c6a410..c6bfdcbf21e5 100644
--- a/ucb/source/ucp/file/filnot.cxx
+++ b/ucb/source/ucp/file/filnot.cxx
@@ -89,11 +89,8 @@ void ContentEventNotifier::notifyRemoved( const OUString& 
aChildName ) const
 {
     rtl::Reference<FileContentIdentifier> xChildId = new 
FileContentIdentifier( aChildName );
 
-    rtl::Reference<BaseContent> pp = new BaseContent( 
m_pMyShell,xChildId,aChildName );
-    {
-        std::unique_lock aGuard( pp->m_aMutex );
-        pp->m_nState |= BaseContent::Deleted;
-    }
+    rtl::Reference<BaseContent> pp = new BaseContent(m_pMyShell, xChildId, 
aChildName,
+                                                     BaseContent::FullFeatured 
| BaseContent::Deleted);
 
     ContentEvent aEvt( m_xCreatorContent,
                        ContentAction::REMOVED,
diff --git a/ucb/source/ucp/file/prov.cxx b/ucb/source/ucp/file/prov.cxx
index 40484c5d9a3c..e8cddd64de9c 100644
--- a/ucb/source/ucp/file/prov.cxx
+++ b/ucb/source/ucp/file/prov.cxx
@@ -106,7 +106,6 @@ FileProvider::getSupportedServiceNames()
 
 // XContent
 
-
 Reference< XContent > SAL_CALL
 FileProvider::queryContent(
     const Reference< XContentIdentifier >& xIdentifier )
@@ -121,10 +120,9 @@ FileProvider::queryContent(
         throw IllegalIdentifierException( THROW_WHERE );
     }
 
-    return Reference< XContent >( new BaseContent( m_pMyShell.get(), 
xIdentifier, aUnc ) );
+    return Reference<XContent>(new BaseContent(m_pMyShell.get(), xIdentifier, 
aUnc));
 }
 
-
 sal_Int32 SAL_CALL
 FileProvider::compareContentIds(
                 const Reference< XContentIdentifier >& Id1,

Reply via email to