summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/fielduno.hxx5
-rw-r--r--sc/source/ui/unoobj/fielduno.cxx26
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);
}
}