Kaydet (Commit) d2981829 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

fdo#46808: Fix previous commit

Removing the xJobExecutor.is() check from
SfxGlobalEvents_Impl::implts_notifyJobExecution was wrong, as
m_xJobExecutorListener was a WeakReference.  However, it appears there is no
good reason for the latter, so the situation can be corrected by turning it into
a plain Reference.

Change-Id: I5690d226b3e8fdd97f75a37502e600b460ec674c
üst eebcaa02
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <com/sun/star/uno/Type.hxx> #include <com/sun/star/uno/Type.hxx>
#include <sal/types.h> #include <sal/types.h>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx> #include <cppuhelper/implbase2.hxx>
#include <cppuhelper/implbase3.hxx> #include <cppuhelper/implbase3.hxx>
...@@ -177,7 +176,7 @@ class SfxGlobalEvents_Impl : public ModelCollectionMutexBase ...@@ -177,7 +176,7 @@ class SfxGlobalEvents_Impl : public ModelCollectionMutexBase
> >
{ {
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xEvents; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xEvents;
::com::sun::star::uno::WeakReference< ::com::sun::star::document::XEventListener > m_xJobExecutorListener; ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener > m_xJobExecutorListener;
OINTERFACECONTAINERHELPER m_aLegacyListeners; OINTERFACECONTAINERHELPER m_aLegacyListeners;
OINTERFACECONTAINERHELPER m_aDocumentListeners; OINTERFACECONTAINERHELPER m_aDocumentListeners;
TModelList m_lModels; TModelList m_lModels;
......
...@@ -551,6 +551,7 @@ SFX_IMPL_ONEINSTANCEFACTORY( SfxGlobalEvents_Impl ); ...@@ -551,6 +551,7 @@ SFX_IMPL_ONEINSTANCEFACTORY( SfxGlobalEvents_Impl );
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
SfxGlobalEvents_Impl::SfxGlobalEvents_Impl( const css::uno::Reference < css::uno::XComponentContext >& rxContext) SfxGlobalEvents_Impl::SfxGlobalEvents_Impl( const css::uno::Reference < css::uno::XComponentContext >& rxContext)
: ModelCollectionMutexBase( ) : ModelCollectionMutexBase( )
, m_xJobExecutorListener( css::task::JobExecutor::create( rxContext ), css::uno::UNO_QUERY_THROW )
, m_aLegacyListeners (m_aLock) , m_aLegacyListeners (m_aLock)
, m_aDocumentListeners (m_aLock) , m_aDocumentListeners (m_aLock)
, pImp (0 ) , pImp (0 )
...@@ -559,7 +560,6 @@ SfxGlobalEvents_Impl::SfxGlobalEvents_Impl( const css::uno::Reference < css::uno ...@@ -559,7 +560,6 @@ SfxGlobalEvents_Impl::SfxGlobalEvents_Impl( const css::uno::Reference < css::uno
SFX_APP(); SFX_APP();
pImp = new GlobalEventConfig(); pImp = new GlobalEventConfig();
m_xEvents = pImp; m_xEvents = pImp;
m_xJobExecutorListener = css::uno::Reference< css::document::XEventListener >( css::task::JobExecutor::create( rxContext ), css::uno::UNO_QUERY_THROW );
m_refCount--; m_refCount--;
} }
...@@ -784,12 +784,7 @@ void SfxGlobalEvents_Impl::implts_notifyJobExecution(const css::document::EventO ...@@ -784,12 +784,7 @@ void SfxGlobalEvents_Impl::implts_notifyJobExecution(const css::document::EventO
{ {
try try
{ {
// SAFE -> m_xJobExecutorListener->notifyEvent(aEvent);
::osl::ResettableMutexGuard aLock(m_aLock);
css::uno::Reference< css::document::XEventListener > xJobExecutor(m_xJobExecutorListener);
aLock.clear();
// <- SAFE
xJobExecutor->notifyEvent(aEvent);
} }
catch(const css::uno::RuntimeException&) catch(const css::uno::RuntimeException&)
{ throw; } { throw; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment