[Libreoffice-commits] core.git: basic/source include/basic

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Aug 3 07:08:17 UTC 2018


 basic/source/basmgr/basmgr.cxx  |    7 -------
 basic/source/uno/namecont.cxx   |    2 +-
 basic/source/uno/scriptcont.cxx |    5 +----
 include/basic/basmgr.hxx        |   11 +----------
 4 files changed, 3 insertions(+), 22 deletions(-)

New commits:
commit cd6486b118c8453f1e494ddeb97021f0ef9181c4
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Aug 2 12:45:01 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Aug 3 09:07:51 2018 +0200

    loplugin:useuniqueptr in BasicManager
    
    Change-Id: I9774a1651c8754f575ebb4b98fbddee5a99a7719
    Reviewed-on: https://gerrit.libreoffice.org/58485
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 1a4948ab9081..e4841ce100e9 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -828,13 +828,6 @@ BasicManager::~BasicManager()
     Broadcast( SfxHint( SfxHintId::Dying) );
 }
 
-void BasicManager::LegacyDeleteBasicManager( BasicManager*& _rpManager )
-{
-    delete _rpManager;
-    _rpManager = nullptr;
-}
-
-
 bool BasicManager::HasExeCode( const OUString& sLib )
 {
     StarBASIC* pLib = GetLib(sLib);
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 910cf3fd9db2..6fd58bcdf08e 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -383,7 +383,7 @@ SfxLibraryContainer::~SfxLibraryContainer()
 {
     if( mbOwnBasMgr )
     {
-        BasicManager::LegacyDeleteBasicManager( mpBasMgr );
+        delete mpBasMgr;
     }
 }
 
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index 14b11e5f0e99..dda0c4824afa 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -336,14 +336,11 @@ void SfxScriptLibraryContainer::importFromOldStorage( const OUString& aFile )
     auto xStorage = tools::make_ref<SotStorage>( false, aFile );
     if( xStorage->GetError() == ERRCODE_NONE )
     {
-        BasicManager* pBasicManager = new BasicManager( *(xStorage.get()), aFile );
+        std::unique_ptr<BasicManager> pBasicManager(new BasicManager( *(xStorage.get()), aFile ));
 
         // Set info
         LibraryContainerInfo aInfo( this, nullptr, static_cast< OldBasicPassword* >( this ) );
         pBasicManager->SetLibraryContainerInfo( aInfo );
-
-        // Now the libraries should be copied to this SfxScriptLibraryContainer
-        BasicManager::LegacyDeleteBasicManager( pBasicManager );
     }
 }
 
diff --git a/include/basic/basmgr.hxx b/include/basic/basmgr.hxx
index 5e70e6ea138b..3229155c6ede 100644
--- a/include/basic/basmgr.hxx
+++ b/include/basic/basmgr.hxx
@@ -130,20 +130,11 @@ protected:
     static bool     ImplEncryptStream( SvStream& rStream );
     BasicLibInfo*   FindLibInfo( StarBASIC const * pBasic );
     static void     CheckModules( StarBASIC* pBasic, bool bReference );
-    virtual ~BasicManager() override;
 
 public:
                     BasicManager( SotStorage& rStorage, const OUString& rBaseURL, StarBASIC* pParentFromStdLib = nullptr, OUString const * pLibPath = nullptr, bool bDocMgr = false );
                     BasicManager( StarBASIC* pStdLib, OUString const * pLibPath = nullptr, bool bDocMgr = false );
-
-    /** deletes the given BasicManager instance
-
-        This method is necessary since normally, BasicManager instances are owned by the BasicManagerRepository,
-        and expected to be deleted by the repository only. However, there exists quite some legacy code,
-        which needs to explicitly delete a BasicManager itself. This code must not use the (protected)
-        destructor, but LegacyDeleteBasicManager.
-    */
-    static void     LegacyDeleteBasicManager( BasicManager*& _rpManager );
+    virtual ~BasicManager() override;
 
     void            SetStorageName( const OUString& rName )   { maStorageName = rName; }
     const OUString& GetStorageName() const                  { return maStorageName; }


More information about the Libreoffice-commits mailing list