dbaccess/source/ui/control/sqledit.cxx | 6 ++--- dbaccess/source/ui/inc/sqledit.hxx | 3 +- desktop/source/deployment/gui/dp_gui_dialog2.cxx | 18 ++++++++-------- desktop/source/deployment/gui/dp_gui_dialog2.hxx | 4 +-- extensions/source/bibliography/datman.cxx | 25 +++++++++++++---------- extensions/source/bibliography/datman.hxx | 13 ++++------- extensions/source/bibliography/general.cxx | 1 7 files changed, 37 insertions(+), 33 deletions(-)
New commits: commit 838036c304d474fc4c19e2fc59cadc6ba457c9ee Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Mar 7 13:46:29 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Mar 8 06:43:46 2023 +0000 osl::Mutex->std::mutex in UpdateRequiredDialog Change-Id: Ic4161d946190f74d016dd81aca44a7623a4e2dcc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148436 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 14fe03882ede..528d92fd5328 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -1080,7 +1080,7 @@ IMPL_LINK_NOARG(UpdateRequiredDialog, HandleCancelBtn, weld::Button&, void) IMPL_LINK( UpdateRequiredDialog, startProgress, void*, _bLockInterface, void ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); bool bLockInterface = static_cast<bool>(_bLockInterface); if ( m_bStartProgress && !m_bHasProgress ) @@ -1106,7 +1106,7 @@ IMPL_LINK( UpdateRequiredDialog, startProgress, void*, _bLockInterface, void ) void UpdateRequiredDialog::showProgress( bool _bStart ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); bool bStart = _bStart; @@ -1132,7 +1132,7 @@ void UpdateRequiredDialog::updateProgress( const tools::Long nProgress ) { if ( m_nProgress != nProgress ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); m_nProgress = nProgress; m_aIdle.Start(); } @@ -1142,7 +1142,7 @@ void UpdateRequiredDialog::updateProgress( const tools::Long nProgress ) void UpdateRequiredDialog::updateProgress( const OUString &rText, const uno::Reference< task::XAbortChannel > &xAbortChannel) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); m_xAbortChannel = xAbortChannel; m_sProgressText = rText; @@ -1172,7 +1172,7 @@ void UpdateRequiredDialog::updatePackageInfo( const uno::Reference< deployment:: IMPL_LINK_NOARG(UpdateRequiredDialog, HandleUpdateBtn, weld::Button&, void) { - ::osl::ClearableMutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); std::vector< uno::Reference< deployment::XPackage > > vUpdateEntries; sal_Int32 nCount = m_xExtensionBox->GetEntryCount(); @@ -1183,7 +1183,7 @@ IMPL_LINK_NOARG(UpdateRequiredDialog, HandleUpdateBtn, weld::Button&, void) vUpdateEntries.push_back( pEntry->m_xPackage ); } - aGuard.clear(); + aGuard.unlock(); m_pManager->getCmdQueue()->checkForUpdates( std::move(vUpdateEntries) ); } @@ -1191,7 +1191,7 @@ IMPL_LINK_NOARG(UpdateRequiredDialog, HandleUpdateBtn, weld::Button&, void) IMPL_LINK_NOARG(UpdateRequiredDialog, HandleCloseBtn, weld::Button&, void) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); if ( !isBusy() ) { @@ -1302,7 +1302,7 @@ bool UpdateRequiredDialog::checkDependencies( const uno::Reference< deployment:: bool UpdateRequiredDialog::hasActiveEntries() { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); bool bRet = false; tools::Long nCount = m_xExtensionBox->GetEntryCount(); @@ -1323,7 +1323,7 @@ bool UpdateRequiredDialog::hasActiveEntries() void UpdateRequiredDialog::disableAllEntries() { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); incBusy(); diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index 9be38f1d7571..8802997e2f20 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -25,7 +25,7 @@ #include <vcl/customweld.hxx> #include <vcl/weld.hxx> -#include <osl/mutex.hxx> +#include <mutex> #include <rtl/ustring.hxx> @@ -184,7 +184,7 @@ class UpdateRequiredDialog : public weld::GenericDialogController { const OUString m_sCloseText; OUString m_sProgressText; - ::osl::Mutex m_aMutex; + std::mutex m_aMutex; bool m_bHasProgress; bool m_bProgressChanged; bool m_bStartProgress; commit 474f68e38b88ca6495cb7c5cc4038100c2786063 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Mar 7 13:48:17 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Mar 8 06:43:40 2023 +0000 osl::Mutex->std::mutex in SQLEditView Change-Id: I5110342b54a3674a521d3f9b8452711650b70d0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148438 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/dbaccess/source/ui/control/sqledit.cxx b/dbaccess/source/ui/control/sqledit.cxx index 49758289e092..86bb65c7b6cb 100644 --- a/dbaccess/source/ui/control/sqledit.cxx +++ b/dbaccess/source/ui/control/sqledit.cxx @@ -54,7 +54,7 @@ private: virtual void SAL_CALL disposing(css::lang::EventObject const &) override { - osl::MutexGuard g(editor_.m_mutex); + std::unique_lock g(editor_.m_mutex); editor_.m_notifier.clear(); } @@ -145,7 +145,7 @@ void SQLEditView::SetDrawingArea(weld::DrawingArea* pDrawingArea) officecfg::Office::Common::Font::SourceViewFont::get(), css::uno::UNO_QUERY_THROW); { - osl::MutexGuard g(m_mutex); + std::unique_lock g(m_mutex); m_notifier = n; } css::uno::Sequence< OUString > s { "FontHeight", "FontName" }; @@ -157,7 +157,7 @@ SQLEditView::~SQLEditView() { css::uno::Reference< css::beans::XMultiPropertySet > n; { - osl::MutexGuard g(m_mutex); + std::unique_lock g(m_mutex); n = m_notifier; } if (n.is()) { diff --git a/dbaccess/source/ui/inc/sqledit.hxx b/dbaccess/source/ui/inc/sqledit.hxx index 0f2ecc8b60eb..d0f8672cc698 100644 --- a/dbaccess/source/ui/inc/sqledit.hxx +++ b/dbaccess/source/ui/inc/sqledit.hxx @@ -25,6 +25,7 @@ #include <svtools/colorcfg.hxx> #include <svx/weldeditview.hxx> #include <vcl/timer.hxx> +#include <mutex> namespace com::sun::star::beans { class XMultiPropertySet; } @@ -45,7 +46,7 @@ namespace dbaui rtl::Reference<SfxItemPool> m_pItemPool; rtl::Reference<ChangesListener> m_listener; - osl::Mutex m_mutex; + std::mutex m_mutex; css::uno::Reference<css::beans::XMultiPropertySet> m_notifier; bool m_bInUpdate; commit 429d53316223809591cb4427b517f0e4266888ed Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Mar 7 16:09:40 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Mar 8 06:43:33 2023 +0000 BaseMutex->std::mutex in BibDataManager Change-Id: Ieb341b37e9643474cfcbed0c0fb0d44e9f079157 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148441 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx index b603d19d685f..4f20e997cc24 100644 --- a/extensions/source/bibliography/datman.cxx +++ b/extensions/source/bibliography/datman.cxx @@ -530,9 +530,7 @@ void SAL_CALL BibInterceptorHelper::setMasterDispatchProvider( const css::uno::R constexpr OUStringLiteral gGridName(u"theGrid"); BibDataManager::BibDataManager() - :BibDataManager_Base( GetMutex() ) - ,m_aLoadListeners(m_aMutex) - ,pBibView( nullptr ) + :pBibView( nullptr ) ,pToolbar(nullptr) { } @@ -1014,8 +1012,9 @@ void SAL_CALL BibDataManager::load( ) { xFormAsLoadable->load(); + std::unique_lock g(m_aMutex); EventObject aEvt( static_cast< XWeak* >( this ) ); - m_aLoadListeners.notifyEach( &XLoadListener::loaded, aEvt ); + m_aLoadListeners.notifyEach( g, &XLoadListener::loaded, aEvt ); } } @@ -1034,13 +1033,15 @@ void SAL_CALL BibDataManager::unload( ) EventObject aEvt( static_cast< XWeak* >( this ) ); { - m_aLoadListeners.notifyEach( &XLoadListener::unloading, aEvt ); + std::unique_lock g(m_aMutex); + m_aLoadListeners.notifyEach( g, &XLoadListener::unloading, aEvt ); } xFormAsLoadable->unload(); { - m_aLoadListeners.notifyEach( &XLoadListener::unloaded, aEvt ); + std::unique_lock g(m_aMutex); + m_aLoadListeners.notifyEach( g, &XLoadListener::unloaded, aEvt ); } } @@ -1059,13 +1060,15 @@ void SAL_CALL BibDataManager::reload( ) EventObject aEvt( static_cast< XWeak* >( this ) ); { - m_aLoadListeners.notifyEach( &XLoadListener::reloading, aEvt ); + std::unique_lock g(m_aMutex); + m_aLoadListeners.notifyEach( g, &XLoadListener::reloading, aEvt ); } xFormAsLoadable->reload(); { - m_aLoadListeners.notifyEach( &XLoadListener::reloaded, aEvt ); + std::unique_lock g(m_aMutex); + m_aLoadListeners.notifyEach( g, &XLoadListener::reloaded, aEvt ); } } @@ -1084,13 +1087,15 @@ sal_Bool SAL_CALL BibDataManager::isLoaded( ) void SAL_CALL BibDataManager::addLoadListener( const Reference< XLoadListener >& aListener ) { - m_aLoadListeners.addInterface( aListener ); + std::unique_lock g(m_aMutex); + m_aLoadListeners.addInterface( g, aListener ); } void SAL_CALL BibDataManager::removeLoadListener( const Reference< XLoadListener >& aListener ) { - m_aLoadListeners.removeInterface( aListener ); + std::unique_lock g(m_aMutex); + m_aLoadListeners.removeInterface( g, aListener ); } diff --git a/extensions/source/bibliography/datman.hxx b/extensions/source/bibliography/datman.hxx index 36cbdcd594b6..405cf83d85a5 100644 --- a/extensions/source/bibliography/datman.hxx +++ b/extensions/source/bibliography/datman.hxx @@ -25,10 +25,9 @@ #include <com/sun/star/form/XForm.hpp> #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp> #include <com/sun/star/form/runtime/XFormController.hpp> -#include <cppuhelper/compbase.hxx> -#include <comphelper/interfacecontainer2.hxx> +#include <comphelper/compbase.hxx> +#include <comphelper/interfacecontainer4.hxx> #include <com/sun/star/form/XLoadable.hpp> -#include <comphelper/broadcasthelper.hxx> #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> #include <com/sun/star/frame/XDispatchProviderInterception.hpp> #include <cppuhelper/implbase.hxx> @@ -72,11 +71,9 @@ public: virtual void SAL_CALL setMasterDispatchProvider( const css::uno::Reference< css::frame::XDispatchProvider >& xNewMasterDispatchProvider ) override; }; -typedef cppu::WeakComponentImplHelper < css::form::XLoadable +typedef comphelper::WeakComponentImplHelper < css::form::XLoadable > BibDataManager_Base; -class BibDataManager final - :public ::comphelper::OMutexAndBroadcastHelper - ,public BibDataManager_Base +class BibDataManager final : public BibDataManager_Base { private: css::uno::Reference< css::form::XForm > m_xForm; @@ -90,7 +87,7 @@ private: OUString aDataSourceURL; OUString aQuoteChar; - ::comphelper::OInterfaceContainerHelper2 m_aLoadListeners; + ::comphelper::OInterfaceContainerHelper4<css::form::XLoadListener> m_aLoadListeners; VclPtr< ::bib::BibView> pBibView; VclPtr<BibToolBar> pToolbar; diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx index 41ed9cd1929f..5e633e4dd98a 100644 --- a/extensions/source/bibliography/general.cxx +++ b/extensions/source/bibliography/general.cxx @@ -29,6 +29,7 @@ #include <o3tl/safeint.hxx> #include <o3tl/string_view.hxx> #include <sal/log.hxx> +#include <osl/diagnose.h> #include <cppuhelper/implbase.hxx> #include <utility> #include <vcl/event.hxx>