From d74c010192a3d9605364bfb942f18c9199a75804 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 23 Apr 2023 20:14:32 +0300 Subject: [PATCH] Use getXWeak in scripting Change-Id: I4370c0bfaa75b150bd05f03a5961e7152ac41e7d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150864 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- scripting/source/dlgprov/dlgevtatt.cxx | 2 +- scripting/source/protocolhandler/scripthandler.cxx | 4 ++-- scripting/source/provider/BrowseNodeFactoryImpl.cxx | 2 +- scripting/source/stringresource/stringresource.cxx | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx index 06a09fc62eda..d697628c4f01 100644 --- a/scripting/source/dlgprov/dlgevtatt.cxx +++ b/scripting/source/dlgprov/dlgevtatt.cxx @@ -377,7 +377,7 @@ namespace dlgprov void DialogAllListenerImpl::firing_impl( const AllEventObject& Event, Any* pRet ) { ScriptEvent aScriptEvent; - aScriptEvent.Source = static_cast(this); // get correct XInterface + aScriptEvent.Source = getXWeak(); // get correct XInterface aScriptEvent.ListenerType = Event.ListenerType; aScriptEvent.MethodName = Event.MethodName; aScriptEvent.Arguments = Event.Arguments; diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx index 5aabb4654b0a..54ca264b32f6 100644 --- a/scripting/source/protocolhandler/scripthandler.cxx +++ b/scripting/source/protocolhandler/scripthandler.cxx @@ -149,7 +149,7 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification( if ( xListener.is() ) { css::frame::DispatchResultEvent aEvent( - static_cast< ::cppu::OWeakObject* >( this ), + getXWeak(), css::frame::DispatchResultState::FAILURE, invokeResult ); try @@ -265,7 +265,7 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification( // executed a macro instead! css::frame::DispatchResultEvent aEvent; - aEvent.Source = static_cast< ::cppu::OWeakObject* >( this ); + aEvent.Source = getXWeak(); aEvent.Result = invokeResult; if ( bSuccess ) { diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx index 8af44a4570a2..3ea45aeecd7e 100644 --- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx +++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx @@ -374,7 +374,7 @@ public: before m_refCount is decremented again */ { m_xAggProxy->setDelegator( - static_cast< cppu::OWeakObject * >( this ) ); + getXWeak() ); } osl_atomic_decrement( &m_refCount ); diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index e1fc4729176c..64988a5aafaf 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -603,7 +603,7 @@ void StringResourceImpl::implModified(std::unique_lock& rGuard) void StringResourceImpl::implNotifyListeners(std::unique_lock& rGuard) { EventObject aEvent; - aEvent.Source = static_cast< XInterface* >( static_cast(this) ); + aEvent.Source = getXWeak(); m_aListenerContainer.forEach(rGuard, [&aEvent](const css::uno::Reference& xListener) {