accessibility/inc/standard/vclxaccessiblelistitem.hxx    |    2 ++
 accessibility/source/standard/vclxaccessiblelistitem.cxx |    9 +++++++--
 basic/source/classes/sb.cxx                              |   10 ++++------
 include/basic/sbmod.hxx                                  |    2 +-
 4 files changed, 14 insertions(+), 9 deletions(-)

New commits:
commit 0fb841d90a8b6cb3e45436489763a875d5bf4c59
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Mon Aug 26 20:40:29 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue Aug 27 09:41:24 2024 +0200

    cid#1554789 Different smart pointers managing same raw pointer
    
    lets just use a shared_ptr here
    
    Change-Id: I31ec113da2c060e8b89ea4e438d182f0f22e810f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172440
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 3c678f6a8219..9720031dfc1a 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -604,7 +604,6 @@ SbxObjectRef createUserTypeImpl( const OUString& rClassName 
)
     return pRetObj;
 }
 
-
 SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
     : SbModule( pClassModule->GetName() )
     , mpClassModule( pClassModule )
@@ -612,8 +611,8 @@ SbClassModuleObject::SbClassModuleObject( SbModule* 
pClassModule )
 {
     aOUSource = pClassModule->aOUSource;
     aComment = pClassModule->aComment;
-    // see comment in destructor about these two
-    pImage.reset(pClassModule->pImage.get());
+    pImage = pClassModule->pImage;
+    // see comment in destructor about this
     pBreaks = pClassModule->pBreaks;
 
     SetClassName( pClassModule->GetName() );
@@ -757,9 +756,8 @@ SbClassModuleObject::~SbClassModuleObject()
                 if( !pDocBasicItem->isDocClosed() )
                     triggerTerminateEvent();
 
-    // prevent the base class destructor from deleting this because:
-    // coverity[leaked_storage] - we do not actually own it
-    pImage.release();
+    // prevent the base class destructor from deleting this because
+    // we do not actually own it
     pBreaks = nullptr;
 }
 
diff --git a/include/basic/sbmod.hxx b/include/basic/sbmod.hxx
index 0463ae13f90f..66b90a4f2a52 100644
--- a/include/basic/sbmod.hxx
+++ b/include/basic/sbmod.hxx
@@ -63,7 +63,7 @@ protected:
     css::uno::Reference< css::script::XInvocation > mxWrapper;
     OUString            aOUSource;
     OUString            aComment;
-    std::unique_ptr<SbiImage> pImage;        // the Image
+    std::shared_ptr<SbiImage> pImage;  // the Image
     SbiBreakpoints*     pBreaks;       // Breakpoints
     std::unique_ptr<SbClassData> pClassData;
     bool mbVBASupport; // Option VBASupport
commit 94273b45b57319e770e8c355392e75390e12811d
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Mon Aug 26 20:25:36 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue Aug 27 09:41:17 2024 +0200

    cid#1608497 Double lock
    
    Change-Id: Idacac84614411efe7516de9aa7740d7d47863ad7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172438
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/accessibility/inc/standard/vclxaccessiblelistitem.hxx 
b/accessibility/inc/standard/vclxaccessiblelistitem.hxx
index 83142b50ed6f..64fd27d4d97c 100644
--- a/accessibility/inc/standard/vclxaccessiblelistitem.hxx
+++ b/accessibility/inc/standard/vclxaccessiblelistitem.hxx
@@ -75,6 +75,8 @@ private:
     virtual css::lang::Locale               implGetLocale() override;
     virtual void                            implGetSelection( sal_Int32& 
nStartIndex, sal_Int32& nEndIndex ) override;
 
+    OUString getTextRangeImpl(std::unique_lock<std::mutex>& rGuard, sal_Int32 
nStartIndex, sal_Int32 nEndIndex);
+
 public:
     /** OAccessibleBase needs a valid view
         @param  _nIndexInParent
diff --git a/accessibility/source/standard/vclxaccessiblelistitem.cxx 
b/accessibility/source/standard/vclxaccessiblelistitem.cxx
index af616805a50e..90f4c8bbebce 100644
--- a/accessibility/source/standard/vclxaccessiblelistitem.cxx
+++ b/accessibility/source/standard/vclxaccessiblelistitem.cxx
@@ -480,12 +480,17 @@ OUString SAL_CALL VCLXAccessibleListItem::getText()
     return m_sEntryText;
 }
 
+OUString 
VCLXAccessibleListItem::getTextRangeImpl(std::unique_lock<std::mutex>& 
/*rGuard*/, sal_Int32 nStartIndex, sal_Int32 nEndIndex)
+{
+    return OCommonAccessibleText::implGetTextRange(m_sEntryText, nStartIndex, 
nEndIndex);
+}
+
 OUString SAL_CALL VCLXAccessibleListItem::getTextRange( sal_Int32 nStartIndex, 
sal_Int32 nEndIndex )
 {
     SolarMutexGuard aSolarGuard;
     std::unique_lock aGuard( m_aMutex );
 
-    return OCommonAccessibleText::implGetTextRange( m_sEntryText, nStartIndex, 
nEndIndex );
+    return getTextRangeImpl(aGuard, nStartIndex, nEndIndex);
 }
 
 css::accessibility::TextSegment SAL_CALL 
VCLXAccessibleListItem::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType )
@@ -527,7 +532,7 @@ sal_Bool SAL_CALL VCLXAccessibleListItem::copyText( 
sal_Int32 nStartIndex, sal_I
         Reference< datatransfer::clipboard::XClipboard > xClipboard = 
pListBoxHelper->GetClipboard();
         if ( xClipboard.is() )
         {
-            OUString sText( getTextRange( nStartIndex, nEndIndex ) );
+            OUString sText(getTextRangeImpl(aGuard, nStartIndex, nEndIndex));
             rtl::Reference<vcl::unohelper::TextDataObject> pDataObj = new 
vcl::unohelper::TextDataObject( sText );
 
             SolarMutexReleaser aReleaser;

Reply via email to