Kaydet (Commit) 87a8d059 authored tarafından Noel Grandin's avatar Noel Grandin

use rtl::Reference in CellShell_Impl

instead of manual acquire/release

Change-Id: I4fde1277c023101e5331e3dad4f0243bd8ac8e3f
üst a232712f
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "formatsh.hxx" #include "formatsh.hxx"
#include "address.hxx" #include "address.hxx"
#include <vcl/window.hxx> #include <vcl/window.hxx>
#include <rtl/ref.hxx>
class SvxClipboardFormatItem; class SvxClipboardFormatItem;
class TransferableDataHelper; class TransferableDataHelper;
...@@ -38,15 +39,12 @@ class AbstractScLinkedAreaDlg; ...@@ -38,15 +39,12 @@ class AbstractScLinkedAreaDlg;
struct CellShell_Impl struct CellShell_Impl
{ {
TransferableClipboardListener* m_pClipEvtLstnr; rtl::Reference<TransferableClipboardListener>
m_xClipEvtLstnr;
VclPtr<AbstractScLinkedAreaDlg> m_pLinkedDlg; VclPtr<AbstractScLinkedAreaDlg> m_pLinkedDlg;
SfxRequest* m_pRequest; SfxRequest* m_pRequest;
CellShell_Impl() : CellShell_Impl();
m_pClipEvtLstnr( nullptr ),
m_pLinkedDlg(),
m_pRequest( nullptr ) {}
~CellShell_Impl(); ~CellShell_Impl();
}; };
......
...@@ -87,15 +87,15 @@ ScCellShell::ScCellShell(ScViewData* pData, VclPtr<vcl::Window> frameWin) : ...@@ -87,15 +87,15 @@ ScCellShell::ScCellShell(ScViewData* pData, VclPtr<vcl::Window> frameWin) :
ScCellShell::~ScCellShell() ScCellShell::~ScCellShell()
{ {
if ( pImpl->m_pClipEvtLstnr ) if ( pImpl->m_xClipEvtLstnr.is() )
{ {
pImpl->m_pClipEvtLstnr->RemoveListener( GetViewData()->GetActiveWin() ); pImpl->m_xClipEvtLstnr->RemoveListener( GetViewData()->GetActiveWin() );
// The listener may just now be waiting for the SolarMutex and call the link // The listener may just now be waiting for the SolarMutex and call the link
// afterwards, in spite of RemoveListener. So the link has to be reset, too. // afterwards, in spite of RemoveListener. So the link has to be reset, too.
pImpl->m_pClipEvtLstnr->ClearCallbackLink(); pImpl->m_xClipEvtLstnr->ClearCallbackLink();
pImpl->m_pClipEvtLstnr->release(); pImpl->m_xClipEvtLstnr.clear();
} }
pImpl->m_pLinkedDlg.disposeAndClear(); pImpl->m_pLinkedDlg.disposeAndClear();
...@@ -556,13 +556,12 @@ void ScCellShell::GetClipState( SfxItemSet& rSet ) ...@@ -556,13 +556,12 @@ void ScCellShell::GetClipState( SfxItemSet& rSet )
// SID_PASTE_SPECIAL // SID_PASTE_SPECIAL
// SID_CLIPBOARD_FORMAT_ITEMS // SID_CLIPBOARD_FORMAT_ITEMS
if ( !pImpl->m_pClipEvtLstnr ) if ( !pImpl->m_xClipEvtLstnr.is() )
{ {
// create listener // create listener
pImpl->m_pClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScCellShell, ClipboardChanged ) ); pImpl->m_xClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScCellShell, ClipboardChanged ) );
pImpl->m_pClipEvtLstnr->acquire();
vcl::Window* pWin = GetViewData()->GetActiveWin(); vcl::Window* pWin = GetViewData()->GetActiveWin();
pImpl->m_pClipEvtLstnr->AddListener( pWin ); pImpl->m_xClipEvtLstnr->AddListener( pWin );
// get initial state // get initial state
TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pWin ) ); TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pWin ) );
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <vcl/builderfactory.hxx> #include <vcl/builderfactory.hxx>
#include <unotools/localedatawrapper.hxx> #include <unotools/localedatawrapper.hxx>
#include <editeng/editview.hxx> #include <editeng/editview.hxx>
#include <svtools/cliplistener.hxx>
#include "cellsh.hxx" #include "cellsh.hxx"
#include "sc.hrc" #include "sc.hrc"
...@@ -2986,6 +2987,10 @@ IMPL_LINK_NOARG(ScCellShell, DialogClosed, Dialog&, void) ...@@ -2986,6 +2987,10 @@ IMPL_LINK_NOARG(ScCellShell, DialogClosed, Dialog&, void)
ExecuteExternalSource( sFile, sFilter, sOptions, sSource, nRefresh, *(pImpl->m_pRequest) ); ExecuteExternalSource( sFile, sFilter, sOptions, sSource, nRefresh, *(pImpl->m_pRequest) );
} }
CellShell_Impl::CellShell_Impl() :
m_pLinkedDlg(),
m_pRequest( nullptr ) {}
CellShell_Impl::~CellShell_Impl() CellShell_Impl::~CellShell_Impl()
{ {
} }
......
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