diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-26 12:06:27 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-26 13:30:49 +0200 |
commit | 4054dff516367b332b7e3ce6fa91a452bf690571 (patch) | |
tree | 74ce35623e84933e4da9b134855ac1c74c4bce1d /sfx2/source/appl/appopen.cxx | |
parent | c0cc59adca23580864a2e5cdadf66212246cbfcc (diff) |
use unique_ptr when Clone()'ing PoolItems
and fix a handful of small leaks in the process
Change-Id: I876e12ff5305f9dda84532d4182fb91657d6fa0c
Reviewed-on: https://gerrit.libreoffice.org/62389
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/appl/appopen.cxx')
-rw-r--r-- | sfx2/source/appl/appopen.cxx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 1c16308dbd4e..c54b3e58580b 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -942,11 +942,11 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) pTargetFrame = &SfxViewFrame::Current()->GetFrame(); // check if caller has set a callback - const SfxLinkItem* pLinkItem = rReq.GetArg<SfxLinkItem>(SID_DONELINK); + std::unique_ptr<SfxLinkItem> pLinkItem; // remove from Itemset, because it confuses the parameter transformation - if ( pLinkItem ) - pLinkItem = static_cast<SfxLinkItem*>( pLinkItem->Clone() ); + if (auto pParamLinkItem = rReq.GetArg<SfxLinkItem>(SID_DONELINK)) + pLinkItem.reset( static_cast<SfxLinkItem*>( pParamLinkItem->Clone() ) ); rReq.RemoveItem( SID_DONELINK ); @@ -1111,7 +1111,6 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) { pLinkItem->GetValue().Call(pRetValue); } - delete pLinkItem; } } |