From b7abdafcfc42722ab060529864a2109d1e4198c0 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 8 Jun 2018 14:27:50 +0200 Subject: return and hold SalMenuItem by std::unique_ptr and drop DestroyMenuItem, all the implementations were just deleting the pointer Change-Id: I058817b963988b1e399279f61f45716a2cdba023 Reviewed-on: https://gerrit.libreoffice.org/55500 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/osx/salmenu.cxx | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'vcl/osx') diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx index c12eb41c236f..ff400fdd4810 100644 --- a/vcl/osx/salmenu.cxx +++ b/vcl/osx/salmenu.cxx @@ -233,19 +233,11 @@ void AquaSalInstance::DestroyMenu( SalMenu* pSalMenu ) delete pSalMenu; } -SalMenuItem* AquaSalInstance::CreateMenuItem( const SalItemParams* pItemData ) +std::unique_ptr AquaSalInstance::CreateMenuItem( const SalItemParams & rItemData ) { - if( !pItemData ) - return nullptr; + AquaSalMenuItem *pSalMenuItem = new AquaSalMenuItem( &rItemData ); - AquaSalMenuItem *pSalMenuItem = new AquaSalMenuItem( pItemData ); - - return pSalMenuItem; -} - -void AquaSalInstance::DestroyMenuItem( SalMenuItem* pSalMenuItem ) -{ - delete pSalMenuItem; + return std::unique_ptr(pSalMenuItem); } /* -- cgit