diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-16 15:20:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-19 20:21:47 +0100 |
commit | 57a70245f5ad4b8bb722c1dc0aaa06f3d42965f4 (patch) | |
tree | ff6e0a1a56f556d2433c7481012881c98e7691a9 /sfx2 | |
parent | 2e832eff2fea4005fb43521593f979657ef7c111 (diff) |
loplugin:useuniqueptr in SvDDEObject
Change-Id: Ia7f98a84bd42289ef0673b52e5e74a6a24554402
Reviewed-on: https://gerrit.libreoffice.org/48168
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/impldde.cxx | 23 | ||||
-rw-r--r-- | sfx2/source/appl/impldde.hxx | 6 |
2 files changed, 13 insertions, 16 deletions
diff --git a/sfx2/source/appl/impldde.cxx b/sfx2/source/appl/impldde.cxx index 2ed6388bbe97..4428f875bd08 100644 --- a/sfx2/source/appl/impldde.cxx +++ b/sfx2/source/appl/impldde.cxx @@ -126,9 +126,9 @@ SvDDEObject::SvDDEObject() SvDDEObject::~SvDDEObject() { - delete pLink; - delete pRequest; - delete pConnection; + pLink.reset(); + pRequest.reset(); + pConnection.reset(); } bool SvDDEObject::GetData( css::uno::Any & rData /*out param*/, @@ -143,8 +143,7 @@ bool SvDDEObject::GetData( css::uno::Any & rData /*out param*/, OUString sServer( pConnection->GetServiceName() ); OUString sTopic( pConnection->GetTopicName() ); - delete pConnection; - pConnection = new DdeConnection( sServer, sTopic ); + pConnection.reset( new DdeConnection( sServer, sTopic ) ); } if( bWaitForData ) // we are in an rekursive loop, get out again @@ -172,9 +171,7 @@ bool SvDDEObject::GetData( css::uno::Any & rData /*out param*/, { // otherwise it will be executed asynchronously { - delete pRequest; - - pRequest = new DdeRequest( *pConnection, sItem ); + pRequest.reset( new DdeRequest( *pConnection, sItem ) ); pRequest->SetDataHdl( LINK( this, SvDDEObject, ImplGetDDEData ) ); pRequest->SetDoneHdl( LINK( this, SvDDEObject, ImplDoneDDEData ) ); pRequest->SetFormat( SotExchange::GetFormatIdFromMimeType( @@ -213,7 +210,7 @@ bool SvDDEObject::Connect( SvBaseLink * pSvLink ) if( sServer.isEmpty() || sTopic.isEmpty() || sItem.isEmpty() ) return false; - pConnection = new DdeConnection( sServer, sTopic ); + pConnection.reset( new DdeConnection( sServer, sTopic ) ); if( pConnection->GetError() ) { // check if the DDE server knows the "SYSTEM" topic @@ -234,7 +231,7 @@ bool SvDDEObject::Connect( SvBaseLink * pSvLink ) if( SfxLinkUpdateMode::ALWAYS == nLinkType && !pLink && !pConnection->GetError() ) { // Setting up Hot Link, Data will be available at some point later on - pLink = new DdeHotLink( *pConnection, sItem ); + pLink.reset( new DdeHotLink( *pConnection, sItem ) ); pLink->SetDataHdl( LINK( this, SvDDEObject, ImplGetDDEData ) ); pLink->SetDoneHdl( LINK( this, SvDDEObject, ImplDoneDDEData ) ); pLink->SetFormat( pSvLink->GetContentType() ); @@ -347,9 +344,9 @@ IMPL_LINK( SvDDEObject, ImplDoneDDEData, bool, bValid, void ) { DdeTransaction* pReq = nullptr; if( !pLink || ( pLink && pLink->IsBusy() )) - pReq = pRequest; // only the one that is ready + pReq = pRequest.get(); // only the one that is ready else if( pRequest && pRequest->IsBusy() ) - pReq = pLink; // only the one that is ready + pReq = pLink.get(); // only the one that is ready if( pReq ) { @@ -357,7 +354,7 @@ IMPL_LINK( SvDDEObject, ImplDoneDDEData, bool, bValid, void ) { pReq->Execute(); } - else if( pReq == pRequest ) + else if( pReq == pRequest.get() ) { bWaitForData = false; } diff --git a/sfx2/source/appl/impldde.hxx b/sfx2/source/appl/impldde.hxx index 5c2bc3a014c4..d161a783fa61 100644 --- a/sfx2/source/appl/impldde.hxx +++ b/sfx2/source/appl/impldde.hxx @@ -35,9 +35,9 @@ class SvDDEObject : public SvLinkSource { OUString sItem; - DdeConnection* pConnection; - DdeLink* pLink; - DdeRequest* pRequest; + std::unique_ptr<DdeConnection> pConnection; + std::unique_ptr<DdeLink> pLink; + std::unique_ptr<DdeRequest> pRequest; css::uno::Any * pGetData; bool bWaitForData; // waiting for data? |