diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-08-09 11:57:21 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-08-09 14:36:53 +0200 |
commit | 6c6358a6822d3562b9b8c7668a7d60d6c644dfe8 (patch) | |
tree | 4ce4604f9aefe08510dd6446b084169f8d234719 /desktop | |
parent | 7e071e5383560c1a85722b134f5a8637585999e5 (diff) |
Related fdo#53006: Do not instantiate service manager too early
... in soffice_main calling GetCommandLineArgs, before Desktop::Init takes care
of synchronization of the per-user bundled/shared extension information (as the
latter potentially modifies data that the service manager consumes upon
instantiation; this e.g. lead to bundled extensions not working during first
start after an upgrade).
The only reason GetCommandLineArgs needed ensureProcessServiceFactory appears to
be the ExternalUriReferenceTranslator. So defer its usage to when the relevant
cmd line args are actually processed (which, luckily, does not yet happen in
soffice_main's usage of GetCommandLineArgs).
Change-Id: I6ebbf0a4ad1c6f64c8fbbe2b0d7628fa42a1afb6
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/app.cxx | 1 | ||||
-rw-r--r-- | desktop/source/app/cmdlineargs.cxx | 74 | ||||
-rw-r--r-- | desktop/source/app/cmdlineargs.hxx | 34 |
3 files changed, 55 insertions, 54 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 84a7516878c7..c3152ee79805 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -283,7 +283,6 @@ namespace CommandLineArgs& Desktop::GetCommandLineArgs() { - ensureProcessServiceFactory(); return theCommandLineArgs::get(); } diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx index c67db8c0564f..f83602829cbd 100644 --- a/desktop/source/app/cmdlineargs.cxx +++ b/desktop/source/app/cmdlineargs.cxx @@ -32,9 +32,7 @@ #include <rtl/ustring.hxx> #include "rtl/process.h" #include <comphelper/processfactory.hxx> -#include <com/sun/star/uri/XExternalUriReferenceTranslator.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp> #include "tools/getprocessworkingdir.hxx" #include <svl/documentlockfile.hxx> @@ -52,6 +50,26 @@ namespace desktop namespace { +OUString translateExternalUris(OUString const & input) { + OUString t( + com::sun::star::uri::ExternalUriReferenceTranslator::create( + comphelper::getProcessComponentContext())-> + translateToInternal(input)); + return t.isEmpty() ? input : t; +} + +std::vector< OUString > translateExternalUris( + std::vector< OUString > const & input) +{ + std::vector< OUString > t; + for (std::vector< OUString >::const_iterator i(input.begin()); + i != input.end(); ++i) + { + t.push_back(translateExternalUris(*i)); + } + return t; +} + class ExtCommandLineSupplier: public CommandLineArgs::Supplier { public: explicit ExtCommandLineSupplier(): @@ -117,14 +135,6 @@ CommandLineArgs::CommandLineArgs( Supplier& supplier ) void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) { m_cwdUrl = supplier.getCwdUrl(); - Reference<XMultiServiceFactory> xMS(comphelper::getProcessServiceFactory(), UNO_QUERY); - OSL_ENSURE(xMS.is(), "CommandLineArgs: no ProcessServiceFactory."); - - Reference< XExternalUriReferenceTranslator > xTranslator( - xMS->createInstance( - OUString( - "com.sun.star.uri.ExternalUriReferenceTranslator")), - UNO_QUERY); // parse command line arguments bool bOpenEvent(true); @@ -150,14 +160,6 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) { break; } - // convert file URLs to internal form - if (aArg.indexOfAsciiL(RTL_CONSTASCII_STRINGPARAM("file:"))==0 && - xTranslator.is()) - { - OUString tmp(xTranslator->translateToInternal(aArg)); - if (!tmp.isEmpty()) - aArg = tmp; - } if ( !aArg.isEmpty() ) { @@ -785,39 +787,39 @@ std::vector< rtl::OUString > const & CommandLineArgs::GetUnaccept() const return m_unaccept; } -std::vector< rtl::OUString > const & CommandLineArgs::GetOpenList() const +std::vector< rtl::OUString > CommandLineArgs::GetOpenList() const { - return m_openlist; + return translateExternalUris(m_openlist); } -std::vector< rtl::OUString > const & CommandLineArgs::GetViewList() const +std::vector< rtl::OUString > CommandLineArgs::GetViewList() const { - return m_viewlist; + return translateExternalUris(m_viewlist); } -std::vector< rtl::OUString > const & CommandLineArgs::GetStartList() const +std::vector< rtl::OUString > CommandLineArgs::GetStartList() const { - return m_startlist; + return translateExternalUris(m_startlist); } -std::vector< rtl::OUString > const & CommandLineArgs::GetForceOpenList() const +std::vector< rtl::OUString > CommandLineArgs::GetForceOpenList() const { - return m_forceopenlist; + return translateExternalUris(m_forceopenlist); } -std::vector< rtl::OUString > const & CommandLineArgs::GetForceNewList() const +std::vector< rtl::OUString > CommandLineArgs::GetForceNewList() const { - return m_forcenewlist; + return translateExternalUris(m_forcenewlist); } -std::vector< rtl::OUString > const & CommandLineArgs::GetPrintList() const +std::vector< rtl::OUString > CommandLineArgs::GetPrintList() const { - return m_printlist; + return translateExternalUris(m_printlist); } -std::vector< rtl::OUString > const & CommandLineArgs::GetPrintToList() const +std::vector< rtl::OUString > CommandLineArgs::GetPrintToList() const { - return m_printtolist; + return translateExternalUris(m_printtolist); } rtl::OUString CommandLineArgs::GetPrinterName() const @@ -835,9 +837,9 @@ std::vector< rtl::OUString > const & CommandLineArgs::GetInFilter() const return m_infilter; } -std::vector< rtl::OUString > const & CommandLineArgs::GetConversionList() const +std::vector< rtl::OUString > CommandLineArgs::GetConversionList() const { - return m_conversionlist; + return translateExternalUris(m_conversionlist); } rtl::OUString CommandLineArgs::GetConversionParams() const @@ -846,7 +848,7 @@ rtl::OUString CommandLineArgs::GetConversionParams() const } rtl::OUString CommandLineArgs::GetConversionOut() const { - return m_conversionout; + return translateExternalUris(m_conversionout); } bool CommandLineArgs::IsEmpty() const diff --git a/desktop/source/app/cmdlineargs.hxx b/desktop/source/app/cmdlineargs.hxx index 4cd19d961051..c6286d2ba895 100644 --- a/desktop/source/app/cmdlineargs.hxx +++ b/desktop/source/app/cmdlineargs.hxx @@ -100,17 +100,17 @@ class CommandLineArgs: private boost::noncopyable bool HasSplashPipe() const; std::vector< rtl::OUString > const & GetAccept() const; std::vector< rtl::OUString > const & GetUnaccept() const; - std::vector< rtl::OUString > const & GetOpenList() const; - std::vector< rtl::OUString > const & GetViewList() const; - std::vector< rtl::OUString > const & GetStartList() const; - std::vector< rtl::OUString > const & GetForceOpenList() const; - std::vector< rtl::OUString > const & GetForceNewList() const; - std::vector< rtl::OUString > const & GetPrintList() const; - std::vector< rtl::OUString > const & GetPrintToList() const; + std::vector< rtl::OUString > GetOpenList() const; + std::vector< rtl::OUString > GetViewList() const; + std::vector< rtl::OUString > GetStartList() const; + std::vector< rtl::OUString > GetForceOpenList() const; + std::vector< rtl::OUString > GetForceNewList() const; + std::vector< rtl::OUString > GetPrintList() const; + std::vector< rtl::OUString > GetPrintToList() const; rtl::OUString GetPrinterName() const; rtl::OUString GetLanguage() const; std::vector< rtl::OUString > const & GetInFilter() const; - std::vector< rtl::OUString > const & GetConversionList() const; + std::vector< rtl::OUString > GetConversionList() const; rtl::OUString GetConversionParams() const; rtl::OUString GetConversionOut() const; @@ -160,17 +160,17 @@ class CommandLineArgs: private boost::noncopyable bool m_bDocumentArgs; // A document creation/open/load arg is used std::vector< rtl::OUString > m_accept; std::vector< rtl::OUString > m_unaccept; - std::vector< rtl::OUString > m_openlist; - std::vector< rtl::OUString > m_viewlist; - std::vector< rtl::OUString > m_startlist; - std::vector< rtl::OUString > m_forceopenlist; - std::vector< rtl::OUString > m_forcenewlist; - std::vector< rtl::OUString > m_printlist; - std::vector< rtl::OUString > m_printtolist; + std::vector< rtl::OUString > m_openlist; // contains external URIs + std::vector< rtl::OUString > m_viewlist; // contains external URIs + std::vector< rtl::OUString > m_startlist; // contains external URIs + std::vector< rtl::OUString > m_forceopenlist; // contains external URIs + std::vector< rtl::OUString > m_forcenewlist; // contains external URIs + std::vector< rtl::OUString > m_printlist; // contains external URIs + std::vector< rtl::OUString > m_printtolist; // contains external URIs rtl::OUString m_printername; - std::vector< rtl::OUString > m_conversionlist; + std::vector< rtl::OUString > m_conversionlist; // contains external URIs rtl::OUString m_conversionparams; - rtl::OUString m_conversionout; + rtl::OUString m_conversionout; // contains external URIs std::vector< rtl::OUString > m_infilter; rtl::OUString m_language; }; |