diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-12-17 08:58:59 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-12-17 10:07:12 +0100 |
commit | 919689ac876eb051f01a09ef67e8140efaa3df32 (patch) | |
tree | 9e697e4160358b4c26277ecabfe31c6d1b66cb8b /basic | |
parent | 0f506617258341596747416549c8f0f879267ab0 (diff) |
Remove unused preliminary entries from ImplRepository::m_aStore again
The comment added to ImplRepository::getDocumentBasicManager by
8e74a57b6cf49cf5296ecc21a111d0119d7cac83 "mib19: #163556# preserve VBA
compatibility in ODF roundtrip" explains why these preliminary entries are
created, but apparently forgot to remove them again when
ImplRepository::impl_createManagerForModel doesn't fill them.
Change-Id: I49ac77a8ca408c0b17d7a7bf7e939a468882ca13
Reviewed-on: https://gerrit.libreoffice.org/85261
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/basmgr/basicmanagerrepository.cxx | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index 296e59327d8f..3c0be766afc0 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -103,7 +103,7 @@ namespace basic @precond our mutex is locked */ - std::unique_ptr<BasicManager>& + BasicManagerStore::iterator impl_getLocationForModel( const Reference< XModel >& _rxDocumentModel ); /** tests if there is a location set at which the BasicManager for the given model @@ -127,7 +127,7 @@ namespace basic the model whose BasicManager will be created. Must not be <NULL/>. */ bool impl_createManagerForModel( - std::unique_ptr<BasicManager>& _out_rpBasicManager, + BasicManagerStore::iterator location, const Reference< XModel >& _rxDocumentModel ); /** creates the application-wide BasicManager @@ -234,11 +234,11 @@ namespace basic thus a recursive call of this function will find and return it without creating another instance. */ - std::unique_ptr<BasicManager>& pBasicManager = impl_getLocationForModel( _rxDocumentModel ); - if (pBasicManager != nullptr) - return pBasicManager.get(); - if (impl_createManagerForModel(pBasicManager, _rxDocumentModel)) - return pBasicManager.get(); + auto const loc = impl_getLocationForModel( _rxDocumentModel ); + if (loc->second != nullptr) + return loc->second.get(); + if (impl_createManagerForModel(loc, _rxDocumentModel)) + return loc->second.get(); return nullptr; } @@ -366,13 +366,12 @@ namespace basic return pAppBasic; } - std::unique_ptr<BasicManager>& ImplRepository::impl_getLocationForModel( const Reference< XModel >& _rxDocumentModel ) + BasicManagerStore::iterator ImplRepository::impl_getLocationForModel( const Reference< XModel >& _rxDocumentModel ) { Reference< XInterface > xNormalized( _rxDocumentModel, UNO_QUERY ); DBG_ASSERT( _rxDocumentModel.is(), "ImplRepository::impl_getLocationForModel: invalid model!" ); - std::unique_ptr<BasicManager>& location = m_aStore[ xNormalized ]; - return location; + return m_aStore.try_emplace(xNormalized).first; } bool ImplRepository::impl_hasLocationForModel( const Reference< XModel >& _rxDocumentModel ) const @@ -408,22 +407,28 @@ namespace basic } } - bool ImplRepository::impl_createManagerForModel( std::unique_ptr<BasicManager>& _out_rpBasicManager, const Reference< XModel >& _rxDocumentModel ) + bool ImplRepository::impl_createManagerForModel( BasicManagerStore::iterator location, const Reference< XModel >& _rxDocumentModel ) { + auto & _out_rpBasicManager = location->second; + StarBASIC* pAppBasic = impl_getDefaultAppBasicLibrary(); _out_rpBasicManager = nullptr; Reference< XStorage > xStorage; if ( !impl_getDocumentStorage_nothrow( _rxDocumentModel, xStorage ) ) { + m_aStore.erase(location); // the document is not able to provide the storage it is based on. return false; } Reference< XPersistentLibraryContainer > xBasicLibs; Reference< XPersistentLibraryContainer > xDialogLibs; if ( !impl_getDocumentLibraryContainers_nothrow( _rxDocumentModel, xBasicLibs, xDialogLibs ) ) + { + m_aStore.erase(location); // the document does not have BasicLibraries and DialogLibraries return false; + } if ( xStorage.is() ) { |