svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx | 7 ++++--- svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-)
New commits: commit dbdfdb74b42b32bd8428acdffac20fe63599a67d Author: Noel Grandin <[email protected]> AuthorDate: Tue Dec 21 17:03:24 2021 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sun Jan 2 07:16:07 2022 +0100 osl::Mutex->std::mutex in ChineseTranslation_UnoDialog Change-Id: Ife56a3d106f64b00b63798d6300e768bbfa81335 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127833 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx index 23635fbc8b94..80cda9bb6555 100644 --- a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx +++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx @@ -32,7 +32,6 @@ using namespace ::com::sun::star; ChineseTranslation_UnoDialog::ChineseTranslation_UnoDialog() : m_bDisposed(false) , m_bInDispose(false) - , m_aDisposeEventListeners(m_aContainerMutex) { } @@ -125,8 +124,8 @@ void SAL_CALL ChineseTranslation_UnoDialog::dispose() aEvt.Source = static_cast< XComponent * >( this ); } - if( m_aDisposeEventListeners.getLength() ) - m_aDisposeEventListeners.disposeAndClear( aEvt ); + std::unique_lock aGuard(m_aContainerMutex); + m_aDisposeEventListeners.disposeAndClear( aGuard, aEvt ); } void SAL_CALL ChineseTranslation_UnoDialog::addEventListener( const uno::Reference< lang::XEventListener > & xListener ) @@ -134,6 +133,7 @@ void SAL_CALL ChineseTranslation_UnoDialog::addEventListener( const uno::Referen SolarMutexGuard aSolarGuard; if( m_bDisposed || m_bInDispose ) return; + std::unique_lock aGuard(m_aContainerMutex); m_aDisposeEventListeners.addInterface( xListener ); } @@ -142,6 +142,7 @@ void SAL_CALL ChineseTranslation_UnoDialog::removeEventListener( const uno::Refe SolarMutexGuard aSolarGuard; if( m_bDisposed || m_bInDispose ) return; + std::unique_lock aGuard(m_aContainerMutex); m_aDisposeEventListeners.removeInterface( xListener ); } diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx index a0faff6c9852..0d40e1227ef5 100644 --- a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx +++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx @@ -29,7 +29,8 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <cppuhelper/implbase.hxx> -#include <comphelper/interfacecontainer3.hxx> +#include <comphelper/interfacecontainer4.hxx> +#include <mutex> namespace textconversiondlgs @@ -108,8 +109,8 @@ private: bool m_bDisposed; ///Dispose call ready. bool m_bInDispose;///In dispose call - osl::Mutex m_aContainerMutex; - comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> m_aDisposeEventListeners; + std::mutex m_aContainerMutex; + comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aDisposeEventListeners; };
