diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-02-14 10:26:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-02-14 14:24:44 +0000 |
commit | 93059e2b164bd5eea4898519e45f1001f299c4ae (patch) | |
tree | 71d6264fe3d415bfd3ac1eccf72c3d8056b93bd9 /sc | |
parent | ce0b9f3eb3f57f57a2315e099a0093c33987e6ca (diff) |
osl::Mutex->std::mutex in ScCellFieldsObj
Change-Id: I7e9a95d093573d786b97f79f9f3b1f18c424fd8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146973
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/fielduno.hxx | 5 | ||||
-rw-r--r-- | sc/source/ui/unoobj/fielduno.cxx | 26 |
2 files changed, 17 insertions, 14 deletions
diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx index fc5ae6d15446..7cf455c7bcc3 100644 --- a/sc/inc/fielduno.hxx +++ b/sc/inc/fielduno.hxx @@ -31,7 +31,6 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/util/XRefreshable.hpp> #include <com/sun/star/util/DateTime.hpp> -#include <comphelper/interfacecontainer3.hxx> #include <comphelper/interfacecontainer4.hxx> #include <comphelper/servicehelper.hxx> #include <cppuhelper/implbase.hxx> @@ -61,9 +60,9 @@ private: ScAddress aCellPos; std::unique_ptr<ScEditSource> mpEditSource; /// List of refresh listeners. - std::unique_ptr<comphelper::OInterfaceContainerHelper3<css::util::XRefreshListener>> mpRefreshListeners; + std::unique_ptr<comphelper::OInterfaceContainerHelper4<css::util::XRefreshListener>> mpRefreshListeners; /// mutex to lock the InterfaceContainerHelper - osl::Mutex aMutex; + std::mutex aMutex; css::uno::Reference<css::text::XTextField> GetObjectByIndex_Impl(sal_Int32 Index) const; diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index afc27560c1fe..2a05a24fab75 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -276,21 +276,24 @@ ScCellFieldsObj::ScCellFieldsObj( ScCellFieldsObj::~ScCellFieldsObj() { - SolarMutexGuard g; + { + SolarMutexGuard g; - if (pDocShell) - pDocShell->GetDocument().RemoveUnoObject(*this); + if (pDocShell) + pDocShell->GetDocument().RemoveUnoObject(*this); - mpEditSource.reset(); + mpEditSource.reset(); + } // increment refcount to prevent double call off dtor osl_atomic_increment( &m_refCount ); + std::unique_lock g(aMutex); if (mpRefreshListeners) { lang::EventObject aEvent; aEvent.Source.set(static_cast<cppu::OWeakObject*>(this)); - mpRefreshListeners->disposeAndClear(aEvent); + mpRefreshListeners->disposeAndClear(g, aEvent); mpRefreshListeners.reset(); } } @@ -383,12 +386,13 @@ void SAL_CALL ScCellFieldsObj::removeContainerListener( // XRefreshable void SAL_CALL ScCellFieldsObj::refresh( ) { + std::unique_lock g(aMutex); if (mpRefreshListeners) { // Call all listeners. lang::EventObject aEvent; aEvent.Source.set(uno::Reference< util::XRefreshable >(this)); - mpRefreshListeners->notifyEach( &util::XRefreshListener::refreshed, aEvent ); + mpRefreshListeners->notifyEach( g, &util::XRefreshListener::refreshed, aEvent ); } } @@ -396,10 +400,10 @@ void SAL_CALL ScCellFieldsObj::addRefreshListener( const uno::Reference< util::X { if (xListener.is()) { - SolarMutexGuard aGuard; + std::unique_lock g(aMutex); if (!mpRefreshListeners) - mpRefreshListeners.reset( new comphelper::OInterfaceContainerHelper3<util::XRefreshListener>(aMutex) ); - mpRefreshListeners->addInterface(xListener); + mpRefreshListeners.reset( new comphelper::OInterfaceContainerHelper4<util::XRefreshListener>() ); + mpRefreshListeners->addInterface(g, xListener); } } @@ -407,9 +411,9 @@ void SAL_CALL ScCellFieldsObj::removeRefreshListener( const uno::Reference<util: { if (xListener.is()) { - SolarMutexGuard aGuard; + std::unique_lock g(aMutex); if (mpRefreshListeners) - mpRefreshListeners->removeInterface(xListener); + mpRefreshListeners->removeInterface(g, xListener); } } |