diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-18 15:38:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-19 08:00:58 +0200 |
commit | 70b05273c91cfec0cd7a9a54ff993c5b7f808d4f (patch) | |
tree | ce12cc92abe8d29726176c426ce803c7502ed2a0 /sfx2 | |
parent | 5288ae5912d6c76cfb80a68025b3af4ba6045c6b (diff) |
use rtl::Reference in AsyncExecuteInfo
instead of storing both a raw pointer and an uno::Reference
Change-Id: Ia52aae8b3894813c4169772eb4cf89ae7df0003a
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 91e1c284f3b7..04e600f096bf 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -124,12 +124,11 @@ public: struct AsyncExecuteInfo { - AsyncExecuteInfo( AsyncExecuteCmd eCmd, uno::Reference< datatransfer::clipboard::XClipboardListener > const & xThis, SfxClipboardChangeListener* pListener ) : - m_eCmd( eCmd ), m_xThis( xThis ), m_pListener( pListener ) {} + AsyncExecuteInfo( AsyncExecuteCmd eCmd, SfxClipboardChangeListener* pListener ) : + m_eCmd( eCmd ), m_xListener( pListener ) {} AsyncExecuteCmd m_eCmd; - uno::Reference< datatransfer::clipboard::XClipboardListener > m_xThis; - SfxClipboardChangeListener* m_pListener; + rtl::Reference<SfxClipboardChangeListener> m_xListener; }; private: @@ -173,13 +172,12 @@ IMPL_STATIC_LINK( SfxClipboardChangeListener, AsyncExecuteHdl_Impl, void*, p, vo AsyncExecuteInfo* pAsyncExecuteInfo = static_cast<AsyncExecuteInfo*>(p); if ( pAsyncExecuteInfo ) { - uno::Reference< datatransfer::clipboard::XClipboardListener > xThis( pAsyncExecuteInfo->m_xThis ); - if ( pAsyncExecuteInfo->m_pListener ) + if ( pAsyncExecuteInfo->m_xListener.is() ) { if ( pAsyncExecuteInfo->m_eCmd == ASYNCEXECUTE_CMD_DISPOSING ) - pAsyncExecuteInfo->m_pListener->DisconnectViewShell(); + pAsyncExecuteInfo->m_xListener->DisconnectViewShell(); else if ( pAsyncExecuteInfo->m_eCmd == ASYNCEXECUTE_CMD_CHANGEDCONTENTS ) - pAsyncExecuteInfo->m_pListener->ChangedContents(); + pAsyncExecuteInfo->m_xListener->ChangedContents(); } } delete pAsyncExecuteInfo; @@ -201,7 +199,7 @@ void SAL_CALL SfxClipboardChangeListener::disposing( const lang::EventObject& /* // Make asynchronous call to avoid locking SolarMutex which is the // root for many deadlocks, especially in conjunction with the "Windows" // based single thread apartment clipboard code! - AsyncExecuteInfo* pInfo = new AsyncExecuteInfo( ASYNCEXECUTE_CMD_DISPOSING, xThis, this ); + AsyncExecuteInfo* pInfo = new AsyncExecuteInfo( ASYNCEXECUTE_CMD_DISPOSING, this ); Application::PostUserEvent( LINK( nullptr, SfxClipboardChangeListener, AsyncExecuteHdl_Impl ), pInfo ); } @@ -211,8 +209,7 @@ void SAL_CALL SfxClipboardChangeListener::changedContents( const datatransfer::c // Make asynchronous call to avoid locking SolarMutex which is the // root for many deadlocks, especially in conjunction with the "Windows" // based single thread apartment clipboard code! - uno::Reference< datatransfer::clipboard::XClipboardListener > xThis( static_cast< datatransfer::clipboard::XClipboardListener* >( this )); - AsyncExecuteInfo* pInfo = new AsyncExecuteInfo( ASYNCEXECUTE_CMD_CHANGEDCONTENTS, xThis, this ); + AsyncExecuteInfo* pInfo = new AsyncExecuteInfo( ASYNCEXECUTE_CMD_CHANGEDCONTENTS, this ); Application::PostUserEvent( LINK( nullptr, SfxClipboardChangeListener, AsyncExecuteHdl_Impl ), pInfo ); } |