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.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara 2024-08-26 20:25:36 +01:00
parent 4c45ce3493
commit 94273b45b5
2 changed files with 9 additions and 2 deletions

View file

@ -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

View file

@ -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;