diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-04 12:26:43 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-05 09:31:29 +0200 |
commit | d02587d79d38997cf74bb0add7dfdf32f26c1fe1 (patch) | |
tree | 4cebe389f7ce4f2a96a9b648de33d111ab1a6548 | |
parent | de688dd0efdc39f6f7b3d98631d5bd08d060b8cc (diff) |
loplugin:useuniqueptr in SbiGlobals
Change-Id: Icbf913058ada4714345d0251970e6420b315270c
Reviewed-on: https://gerrit.libreoffice.org/60001
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | basic/source/basmgr/basicmanagerrepository.cxx | 15 | ||||
-rw-r--r-- | basic/source/inc/sbintern.hxx | 2 |
2 files changed, 7 insertions, 10 deletions
diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index 1f110f9b77e3..1cc6eab188cf 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -83,7 +83,7 @@ namespace basic BasicManager* getDocumentBasicManager( const Reference< XModel >& _rxDocumentModel ); BasicManager* getOrCreateApplicationBasicManager(); static BasicManager* getApplicationBasicManager(); - static void setApplicationBasicManager( BasicManager* _pBasicManager ); + static void setApplicationBasicManager( std::unique_ptr<BasicManager> _pBasicManager ); void registerCreationListener( BasicManagerCreationListener& _rListener ); void revokeCreationListener( BasicManagerCreationListener& _rListener ); @@ -241,7 +241,7 @@ namespace basic { SolarMutexGuard g; - BasicManager* pAppManager = GetSbData()->pAppBasMgr; + BasicManager* pAppManager = GetSbData()->pAppBasMgr.get(); if (pAppManager == nullptr) pAppManager = impl_createApplicationBasicManager(); return pAppManager; @@ -251,17 +251,14 @@ namespace basic { SolarMutexGuard g; - return GetSbData()->pAppBasMgr; + return GetSbData()->pAppBasMgr.get(); } - void ImplRepository::setApplicationBasicManager( BasicManager* _pBasicManager ) + void ImplRepository::setApplicationBasicManager( std::unique_ptr<BasicManager> _pBasicManager ) { SolarMutexGuard g; - BasicManager* pPreviousManager = getApplicationBasicManager(); - delete pPreviousManager; - - GetSbData()->pAppBasMgr = _pBasicManager; + GetSbData()->pAppBasMgr = std::move(_pBasicManager); } @@ -285,7 +282,7 @@ namespace basic aAppBasic.insertName( Application::GetAppName() ); BasicManager* pBasicManager = new BasicManager( new StarBASIC, &aAppBasicDir ); - setApplicationBasicManager( pBasicManager ); + setApplicationBasicManager( std::unique_ptr<BasicManager>(pBasicManager) ); // The first dir in the path as destination: OUString aFileName( aAppBasic.getName() ); diff --git a/basic/source/inc/sbintern.hxx b/basic/source/inc/sbintern.hxx index 70e6e69a1e23..55345348cff4 100644 --- a/basic/source/inc/sbintern.hxx +++ b/basic/source/inc/sbintern.hxx @@ -100,7 +100,7 @@ struct SbiGlobals OUString aErrMsg; // buffer for GetErrorText() std::unique_ptr<::utl::TransliterationWrapper> pTransliterationWrapper; // For StrComp bool bBlockCompilerError; - BasicManager* pAppBasMgr; + std::unique_ptr<BasicManager> pAppBasMgr; StarBASIC* pMSOMacroRuntimLib; // Lib containing MSO Macro Runtime API entry symbols SbiGlobals(); |