ucb/source/ucp/file/bc.cxx |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

New commits:
commit aed39170cea65926bb4e497dfde08e4e16f9ee8f
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Nov 28 12:53:50 2024 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sat Dec 14 21:55:01 2024 +0100

    cid#1606940 Check of thread-shared field evades lock acquisition
    
    and
    
    cid#1608607 Check of thread-shared field evades lock acquisition
    
    futile to lock m_nState
    
     #1  0x00007f3bdc4a9cc1 in pthread_mutex_lock@@GLIBC_2.2.5 () at 
/lib64/libc.so.6
     #2  0x00007f3bc48b0683 in __gthread_mutex_lock (__mutex=0x29ae4698) at 
/usr/bin/../lib/gcc/x86_64-redhat-linux/14/../../../../include/c++/14/x86_64-redhat-linux/bits/gthr-default.h:762
     #3  0x00007f3bc48b9505 in std::mutex::lock (this=0x29ae4698) at 
/usr/bin/../lib/gcc/x86_64-redhat-linux/14/../../../../include/c++/14/bits/std_mutex.h:113
     #4  0x00007f3bc48b8bec in std::unique_lock<std::mutex>::lock 
(this=0x7fffa21aa7e8) at 
/usr/bin/../lib/gcc/x86_64-redhat-linux/14/../../../../include/c++/14/bits/unique_lock.h:147
     #5  0x00007f3bc48b0b58 in std::unique_lock<std::mutex>::unique_lock 
(this=0x7fffa21aa7e8, __m=...) at 
/usr/bin/../lib/gcc/x86_64-redhat-linux/14/../../../../include/c++/14/bits/unique_lock.h:73
     #6  0x00007f3bc48af7cc in fileaccess::BaseContent::cDEL (this=0x29ae4600) 
at core/ucb/source/ucp/file/bc.cxx:1126
     #7  0x00007f3bc48af9d4 in non-virtual thunk to 
fileaccess::BaseContent::cDEL() () at 
core/instdir/program/../program/libucpfile1.so
     #8  0x00007f3bc492d43f in 
fileaccess::TaskManager::getContentDeletedEventListeners (this=0x29ab47e0, 
aName="file://core/instdir/program/../share/config/cdefghij.klm")
         at core/ucb/source/ucp/file/filtask.cxx:2581
     #9  0x00007f3bc492caaa in fileaccess::TaskManager::remove
         (this=0x29ab47e0, CommandId=5, 
aUnqPath="file://core/instdir/program/../share/config/cdefghij.klm", 
IsWhat=fileaccess::TaskManager::FileUrlType::File, MustExist=true)
         at core/ucb/source/ucp/file/filtask.cxx:1572
     #10 0x00007f3bc48ab8c2 in fileaccess::BaseContent::deleteContent 
(this=0x29ae4600, nMyCommandIdentifier=5) at core/ucb/source/ucp/file/bc.cxx:934
     #11 0x00007f3bc48a9891 in fileaccess::BaseContent::execute 
(this=0x29ae4600, aCommand=..., CommandId=5, Environment=empty uno::Reference) 
at core/ucb/source/ucp/file/bc.cxx:300
     #12 0x00007f3bc48ad00a in non-virtual thunk to 
fileaccess::BaseContent::execute(com::sun::star::ucb::Command const&, int, 
com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> 
const&) ()
         at core/instdir/program/../program/libucpfile1.so
     #13 0x00007f3bdc8f5537 in ucbhelper::Content_Impl::executeCommand 
(this=0x29adfb80, rCommand=...) at core/ucbhelper/source/client/content.cxx:1260
     #14 0x00007f3bdc8f673c in ucbhelper::Content::executeCommand 
(this=0x7fffa21ab0a0, rCommandName="delete", 
rCommandArgument=uno::Any("boolean": 1 ''))
         at core/ucbhelper/source/client/content.cxx:562
     #15 0x00007f3bdf7fd2c1 in KillFile (rURL=...) at 
core/svx/source/gallery2/galmisc.cxx:291
    
    Change-Id: Iff9114adb4d5fe2ccf0d5a10fdd91295393a7820
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177519
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx
index b813882b33af..4782ba3c96a2 100644
--- a/ucb/source/ucp/file/bc.cxx
+++ b/ucb/source/ucp/file/bc.cxx
@@ -473,7 +473,6 @@ BaseContent::addProperty(
 void SAL_CALL
 BaseContent::removeProperty( const OUString& Name )
 {
-
     if( m_nState & Deleted )
         throw beans::UnknownPropertyException( Name );
 
@@ -894,13 +893,9 @@ BaseContent::deleteContent( sal_Int32 nMyCommandIdentifier 
)
         return;
 
     if( m_pMyShell->remove( nMyCommandIdentifier,m_aUncPath ) )
-    {
-        std::unique_lock aGuard( m_aMutex );
         m_nState |= Deleted;
-    }
 }
 
-
 void
 BaseContent::transfer( sal_Int32 nMyCommandIdentifier,
                        const TransferInfo& aTransferInfo )
@@ -1072,7 +1067,6 @@ void BaseContent::insert( sal_Int32 nMyCommandIdentifier,
     m_pMyShell->registerNotifier( m_aUncPath,this );
     m_pMyShell->insertDefaultProperties( m_aUncPath );
 
-    std::unique_lock aGuard( m_aMutex );
     m_nState = FullFeatured;
 }
 
@@ -1087,10 +1081,9 @@ void BaseContent::endTask( sal_Int32 CommandId )
 std::optional<ContentEventNotifier>
 BaseContent::cDEL()
 {
-    std::unique_lock aGuard( m_aMutex );
-
     m_nState |= Deleted;
 
+    std::unique_lock aGuard( m_aMutex );
     if( m_aContentEventListeners.getLength(aGuard) == 0 )
         return {};
 

Reply via email to