diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-17 10:13:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-17 10:48:27 +0000 |
commit | 49bfc59272f8482ca37abc631d2c3777518fd1d5 (patch) | |
tree | e01cb4a3fa03b6dbd7107e409de83de19813d804 /sfx2/source/view/viewprn.cxx | |
parent | 88c755e37cd36ddfe6d0d651540d9f2bd8a029a6 (diff) |
new loplugin: useuniqueptr: sfx2
Change-Id: I544c615105d14fa258fed7f30790d305e987f523
Reviewed-on: https://gerrit.libreoffice.org/33206
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/view/viewprn.cxx')
-rw-r--r-- | sfx2/source/view/viewprn.cxx | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 8ae4c73d1207..b73e1c4150ee 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -404,17 +404,17 @@ class SfxDialogExecutor_Impl private: SfxViewShell* _pViewSh; VclPtr<PrinterSetupDialog> _pSetupParent; - SfxItemSet* _pOptions; + std::unique_ptr<SfxItemSet> _pOptions; bool _bHelpDisabled; DECL_LINK( Execute, Button*, void ); public: SfxDialogExecutor_Impl( SfxViewShell* pViewSh, PrinterSetupDialog* pParent ); - ~SfxDialogExecutor_Impl() { delete _pOptions; } + ~SfxDialogExecutor_Impl() {} Link<Button*, void> GetLink() const { return LINK(const_cast<SfxDialogExecutor_Impl*>(this), SfxDialogExecutor_Impl, Execute); } - const SfxItemSet* GetOptions() const { return _pOptions; } + const SfxItemSet* GetOptions() const { return _pOptions.get(); } void DisableHelp() { _bHelpDisabled = true; } }; @@ -435,7 +435,7 @@ IMPL_LINK_NOARG(SfxDialogExecutor_Impl, Execute, Button*, void) { DBG_ASSERT( _pSetupParent, "no dialog parent" ); if( _pSetupParent ) - _pOptions = static_cast<SfxPrinter*>( _pSetupParent->GetPrinter() )->GetOptions().Clone(); + _pOptions.reset( static_cast<SfxPrinter*>( _pSetupParent->GetPrinter() )->GetOptions().Clone() ); } assert(_pOptions); @@ -444,14 +444,12 @@ IMPL_LINK_NOARG(SfxDialogExecutor_Impl, Execute, Button*, void) // Create Dialog VclPtrInstance<SfxPrintOptionsDialog> pDlg( static_cast<vcl::Window*>(_pSetupParent), - _pViewSh, _pOptions ); + _pViewSh, _pOptions.get() ); if ( _bHelpDisabled ) pDlg->DisableHelp(); if ( pDlg->Execute() == RET_OK ) { - delete _pOptions; - _pOptions = pDlg->GetOptions().Clone(); - + _pOptions.reset( pDlg->GetOptions().Clone() ); } } |