diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index de78275bb205..4ba55848494d 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -655,8 +655,22 @@ Reference ExtensionManager::addExtension( //would remove the first one. ::osl::MutexGuard addGuard(m_addMutex); - Reference xTmpExtension = - getTempExtension(url, xAbortChannel, xCmdEnv); + Reference xTmpRepository(getTmpRepository()); + // make sure xTmpRepository is alive as long as xTmpExtension is; as + // the "tmp" manager is only held weakly by m_xPackageManagerFactory, it + // could otherwise be disposed early, which would in turn dispose + // xTmpExtension's PackageRegistryBackend behind its back + Reference xTmpExtension( + xTmpRepository->addPackage( + url, uno::Sequence(), OUString(), xAbortChannel, + new TmpRepositoryCommandEnv())); + if (!xTmpExtension.is()) { + throw deploy::DeploymentException( + ("Extension Manager: Failed to create temporary XPackage for url: " + + url), + static_cast(this), uno::Any()); + } + //Make sure the extension is removed from the tmp repository in case //of an exception ExtensionRemoveGuard tmpExtensionRemoveGuard(xTmpExtension, getTmpRepository()); @@ -1404,25 +1418,6 @@ void ExtensionManager::checkUpdate( static_cast(this), request ); } -Reference ExtensionManager::getTempExtension( - OUString const & url, - Reference const & xAbortChannel, - Reference const & /*xCmdEnv*/) - -{ - Reference tmpCmdEnvA(new TmpRepositoryCommandEnv()); - Reference xTmpPackage = getTmpRepository()->addPackage( - url, uno::Sequence(),OUString(), xAbortChannel, tmpCmdEnvA); - if (!xTmpPackage.is()) - { - throw deploy::DeploymentException( - OUSTR("Extension Manager: Failed to create temporary XPackage for url: ") + url, - static_cast(this), uno::Any()); - - } - return xTmpPackage; -} - uno::Sequence > SAL_CALL ExtensionManager::getExtensionsWithUnacceptedLicenses( OUString const & repository, diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx b/desktop/source/deployment/manager/dp_extensionmanager.hxx index c8d8b300da60..584f01ce07c1 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.hxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx @@ -280,11 +280,6 @@ private: css::uno::Reference const & oldExtension, css::uno::Reference const & xCmdEnv); - css::uno::Reference getTempExtension( - ::rtl::OUString const & url, - css::uno::Reference const & xAbortChannel, - css::uno::Reference const & xCmdEnv); - void addExtensionsToMap( id2extensions & mapExt, css::uno::Sequence > const & seqExt,