From 94273b45b57319e770e8c355392e75390e12811d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 26 Aug 2024 20:25:36 +0100 Subject: [PATCH] cid#1608497 Double lock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Idacac84614411efe7516de9aa7740d7d47863ad7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172438 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- accessibility/inc/standard/vclxaccessiblelistitem.hxx | 2 ++ accessibility/source/standard/vclxaccessiblelistitem.cxx | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) 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& 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& /*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 pDataObj = new vcl::unohelper::TextDataObject( sText ); SolarMutexReleaser aReleaser;