svl/source/fsstor/fsstorage.cxx | 19 +++++++++++++------ svl/source/fsstor/fsstorage.hxx | 5 +++++ 2 files changed, 18 insertions(+), 6 deletions(-)
New commits: commit ca84e561a0d0bce89258671ab32bcf5fb5a4ca29 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri Jul 19 09:52:37 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Fri Jul 19 13:14:25 2024 +0200 cid#1608321 Double lock Change-Id: I831db1632e2a8fab9194ffb54df61f55e6304864 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170748 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx index 95f498b71ce2..a3be4b3f3e80 100644 --- a/svl/source/fsstor/fsstorage.cxx +++ b/svl/source/fsstor/fsstorage.cxx @@ -648,12 +648,11 @@ void SAL_CALL FSStorage::renameElement( const OUString& aElementName, const OUSt } } -void SAL_CALL FSStorage::copyElementTo( const OUString& aElementName, - const uno::Reference< embed::XStorage >& xDest, - const OUString& aNewName ) +void FSStorage::copyElementToImpl(std::unique_lock<std::mutex>& /*rGuard*/, + std::u16string_view aElementName, + const uno::Reference< embed::XStorage >& xDest, + const OUString& aNewName ) { - std::unique_lock aGuard( m_aMutex ); - if ( !xDest.is() ) throw uno::RuntimeException(); @@ -719,12 +718,20 @@ void SAL_CALL FSStorage::copyElementTo( const OUString& aElementName, } } +void SAL_CALL FSStorage::copyElementTo( const OUString& aElementName, + const uno::Reference< embed::XStorage >& xDest, + const OUString& aNewName ) +{ + std::unique_lock aGuard( m_aMutex ); + copyElementToImpl(aGuard, aElementName, xDest, aNewName); +} + void SAL_CALL FSStorage::moveElementTo( const OUString& aElementName, const uno::Reference< embed::XStorage >& xDest, const OUString& aNewName ) { std::unique_lock aGuard( m_aMutex ); - copyElementTo( aElementName, xDest, aNewName ); + copyElementToImpl(aGuard, aElementName, xDest, aNewName); INetURLObject aOwnURL( m_aURL ); aOwnURL.Append( aElementName ); diff --git a/svl/source/fsstor/fsstorage.hxx b/svl/source/fsstor/fsstorage.hxx index 6b02a9a61b83..8b86ed9b1458 100644 --- a/svl/source/fsstor/fsstorage.hxx +++ b/svl/source/fsstor/fsstorage.hxx @@ -179,6 +179,11 @@ private: css::uno::Reference< css::io::XStream > openStreamElementImpl( std::unique_lock<std::mutex>& rGuard, std::u16string_view aStreamName, sal_Int32 nOpenMode ); + void copyElementToImpl(std::unique_lock<std::mutex>& rGuard, + std::u16string_view ElementName, + const css::uno::Reference< css::embed::XStorage >& xDest, + const OUString& rNewName); + void disposeImpl(std::unique_lock<std::mutex>& rGuard); };