Skip to content

Commit

Permalink
cid#1606940 Check of thread-shared field evades lock acquisition
Browse files Browse the repository at this point in the history
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 '\001'))
     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 <[email protected]>
Tested-by: Jenkins
  • Loading branch information
caolanm committed Dec 14, 2024
1 parent 877205c commit aed3917
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions ucb/source/ucp/file/bc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,6 @@ BaseContent::addProperty(
void SAL_CALL
BaseContent::removeProperty( const OUString& Name )
{

if( m_nState & Deleted )
throw beans::UnknownPropertyException( Name );

Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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;
}

Expand All @@ -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 {};

Expand Down

0 comments on commit aed3917

Please sign in to comment.