diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-11-08 12:00:27 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-11-08 15:23:52 +0100 |
commit | ed0b12f4eadf1f2242f06cbd56804f75376274b1 (patch) | |
tree | 7028abd9cf514c74bd1b795cc6398b0bb433f319 /desktop/source | |
parent | 5ff283e3b841230a45715e48a251c3c4216d1cec (diff) |
no need to take a copy of the getProcessComponentContext return value
we can just take a "const &".
(found by running clang-tidy with the
performance-unnecessary-copy-initialization warning)
Change-Id: I20fd208c65303da78170b1ac06c638fdf3aa094b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176267
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Diffstat (limited to 'desktop/source')
-rw-r--r-- | desktop/source/app/app.cxx | 16 | ||||
-rw-r--r-- | desktop/source/app/appinit.cxx | 2 | ||||
-rw-r--r-- | desktop/source/app/check_ext_deps.cxx | 4 | ||||
-rw-r--r-- | desktop/source/app/dispatchwatcher.cxx | 4 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_service.cxx | 2 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_updatedialog.cxx | 2 | ||||
-rw-r--r-- | desktop/source/deployment/misc/dp_descriptioninfoset.cxx | 2 | ||||
-rw-r--r-- | desktop/source/migration/migration.cxx | 4 |
8 files changed, 18 insertions, 18 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index e6a2feca09ff..c38fd40944ee 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -964,7 +964,7 @@ void handleCrashReport() #if !defined ANDROID void handleSafeMode() { - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< css::frame::XSynchronousDispatch > xSafeModeUI( xContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.comp.svx.SafeModeUI"_ustr, xContext), @@ -1033,7 +1033,7 @@ bool impl_callRecoveryUI(bool bEmergencySave , static constexpr OUStringLiteral COMMAND_EMERGENCYSAVE = u"vnd.sun.star.autorecovery:/doEmergencySave"; static constexpr OUStringLiteral COMMAND_RECOVERY = u"vnd.sun.star.autorecovery:/doAutoRecovery"; - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); g_xRecoveryUI.set( xContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.comp.svx.RecoveryUI"_ustr, xContext), @@ -1375,7 +1375,7 @@ int Desktop::Main() recordTime(startT, "SetSplashScreenProgress(20): time = "); - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< XRestartManager > xRestartManager( OfficeRestartManager::get(xContext) ); @@ -2338,7 +2338,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) case ApplicationEvent::Type::Appear: if ( !GetCommandLineArgs().IsInvisible() && !impl_bringToFrontRecoveryUI() ) { - Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); // find active task - the active task is always a visible task Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( xContext ); @@ -2427,7 +2427,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) // NOTICE: The quickstart service must be initialized inside the "main thread", so we use the // application events to do this (they are executed inside main thread)!!! // Don't start quickstart service if the user specified "--invisible" on the command line! - Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); css::office::Quickstart::createStart(xContext, true/*Quickstart*/); } break; @@ -2437,7 +2437,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) // The user will try it again, in case nothing happens .-) try { - Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( xContext ); @@ -2512,7 +2512,7 @@ void Desktop::OpenSplashScreen() aSplashService = "com.sun.star.office.PipeSplashScreen"; Sequence< Any > aSeq{ Any(true) /* bVisible */, Any(aAppName) }; - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const css::uno::Reference< css::uno::XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); m_rSplashScreen.set( xContext->getServiceManager()->createInstanceWithArgumentsAndContext(aSplashService, aSeq, xContext), UNO_QUERY); @@ -2583,7 +2583,7 @@ void Desktop::ShowBackingComponent(Desktop * progress) { return; } - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = comphelper::getProcessComponentContext(); Reference< XDesktop2 > xDesktop = css::frame::Desktop::create(xContext); if (progress != nullptr) { diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx index 6c7637f32f9e..a9d70d3da45a 100644 --- a/desktop/source/app/appinit.cxx +++ b/desktop/source/app/appinit.cxx @@ -228,7 +228,7 @@ void Desktop::createAcceptor(const OUString& aAcceptString) } Sequence< Any > aSeq{ Any(aAcceptString), Any(bAccept) }; - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + const Reference< XComponentContext >& xContext = ::comphelper::getProcessComponentContext(); Reference<XInitialization> rAcceptor( xContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.office.Acceptor"_ustr, xContext), UNO_QUERY ); diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx index 52047e0230fb..90446384f311 100644 --- a/desktop/source/app/check_ext_deps.cxx +++ b/desktop/source/app/check_ext_deps.cxx @@ -381,7 +381,7 @@ bool Desktop::CheckExtensionDependencies() return false; } - uno::Reference< uno::XComponentContext > xContext( + const uno::Reference< uno::XComponentContext >& xContext( comphelper::getProcessComponentContext()); bool bDependenciesValid = impl_checkDependencies( xContext ); @@ -402,7 +402,7 @@ bool Desktop::CheckExtensionDependencies() void Desktop::SynchronizeExtensionRepositories(bool bCleanedExtensionCache, Desktop* pDesktop) { - uno::Reference< uno::XComponentContext > context( + const uno::Reference< uno::XComponentContext >& context( comphelper::getProcessComponentContext()); uno::Reference< ucb::XCommandEnvironment > silent( new SilentCommandEnv(context, pDesktop)); diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 2f5524ae2d68..faf830ffae3c 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -102,7 +102,7 @@ std::shared_ptr<const SfxFilter> impl_lookupExportFilterForUrl( std::u16string_v ":eflags=" + OUString::number(static_cast<int>(SFX_FILTER_NOTINSTALLED)); - const Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); const Reference< XContainerQuery > xFilterFactory( xContext->getServiceManager()->createInstanceWithContext( u"com.sun.star.document.FilterFactory"_ustr, xContext ), UNO_QUERY_THROW ); @@ -134,7 +134,7 @@ std::shared_ptr<const SfxFilter> impl_getExportFilterFromUrl( { try { - const Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + const Reference< XComponentContext >& xContext( comphelper::getProcessComponentContext() ); const Reference< document::XTypeDetection > xTypeDetector( xContext->getServiceManager()->createInstanceWithContext( u"com.sun.star.document.TypeDetection"_ustr, xContext ), UNO_QUERY_THROW ); diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx index 896c181f5807..23733bd349aa 100644 --- a/desktop/source/deployment/gui/dp_gui_service.cxx +++ b/desktop/source/deployment/gui/dp_gui_service.cxx @@ -74,7 +74,7 @@ int MyApp::Main() void MyApp::DeInit() { - css::uno::Reference< css::uno::XComponentContext > context( + const css::uno::Reference< css::uno::XComponentContext >& context( comphelper::getProcessComponentContext()); dp_misc::disposeBridges(context); css::uno::Reference< css::lang::XComponent >( diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index 5d22ca840585..9117fdfd1048 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -619,7 +619,7 @@ void UpdateDialog::createNotifyJob( bool bPrepareOnly, util::URL aURL; xNameAccess->getByName(u"URL"_ustr) >>= aURL.Complete; - uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const uno::Reference< uno::XComponentContext >& xContext( ::comphelper::getProcessComponentContext() ); uno::Reference < util::XURLTransformer > xTransformer = util::URLTransformer::create(xContext); xTransformer->parseStrict(aURL); diff --git a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx index 0da83782f1f9..73000af5ddb6 100644 --- a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx +++ b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx @@ -296,7 +296,7 @@ namespace dp_misc { DescriptionInfoset getDescriptionInfoset(std::u16string_view sExtensionFolderURL) { Reference< css::xml::dom::XNode > root; - Reference<css::uno::XComponentContext> context( + const Reference<css::uno::XComponentContext>& context( comphelper::getProcessComponentContext()); try { root = diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index c5ecbdd7dd02..439265546ae7 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -201,7 +201,7 @@ bool MigrationImpl::doMigration() OUString aOldCfgDataPath = m_aInfo.userdata + "/user/config/soffice.cfg/modules/" + i.sModuleShortName; uno::Sequence< uno::Any > lArgs {uno::Any(aOldCfgDataPath), uno::Any(embed::ElementModes::READ)}; - uno::Reference< uno::XComponentContext > xContext(comphelper::getProcessComponentContext()); + const uno::Reference< uno::XComponentContext >& xContext(comphelper::getProcessComponentContext()); uno::Reference< lang::XSingleServiceFactory > xStorageFactory(embed::FileSystemStorageFactory::create(xContext)); uno::Reference< embed::XStorage > xModules(xStorageFactory->createInstanceWithArguments(lArgs), uno::UNO_QUERY); uno::Reference< ui::XUIConfigurationManager2 > xOldCfgManager = ui::UIConfigurationManager::create(xContext); @@ -868,7 +868,7 @@ void MigrationImpl::runServices() // and execute the migration job uno::Reference< XJob > xMigrationJob; - uno::Reference< uno::XComponentContext > xContext(comphelper::getProcessComponentContext()); + const uno::Reference< uno::XComponentContext >& xContext(comphelper::getProcessComponentContext()); for (auto const& rMigration : *m_vrMigrations) { if( !rMigration.service.isEmpty()) { |