diff options
-rw-r--r-- | desktop/inc/app.hxx | 4 | ||||
-rw-r--r-- | desktop/source/app/app.cxx | 14 | ||||
-rw-r--r-- | desktop/source/app/sofficemain.cxx | 1 |
3 files changed, 14 insertions, 5 deletions
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index b950d2583097..f4b00f53fc35 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -138,11 +138,11 @@ class Desktop : public Application void SetSplashScreenText( const ::rtl::OUString& rText ); void SetSplashScreenProgress( sal_Int32 ); - void CreateProcessServiceFactory(); + static void ensureProcessServiceFactory(); private: // Bootstrap methods - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > CreateApplicationServiceManager(); + static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > CreateApplicationServiceManager(); void RegisterServices( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr ); void DeregisterServices(); diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 611234f3d80b..efe2038a69ec 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -320,6 +320,7 @@ namespace CommandLineArgs& Desktop::GetCommandLineArgs() { + ensureProcessServiceFactory(); return theCommandLineArgs::get(); } @@ -707,7 +708,13 @@ void Desktop::Init() } } - // We need to have service factory before going further. + // We need to have service factory before going further, but see fdo#37195. + // Doing this will mmap common.rdb, making it not overwritable on windows, + // so this can't happen before the synchronization above. Lets rework this + // so that the above is called *from* ensureProcessServiceFactory or + // something to enforce this gotcha + ensureProcessServiceFactory(); + if( !::comphelper::getProcessServiceFactory().is()) { OSL_FAIL("Service factory should have been crated in soffice_main()."); @@ -759,8 +766,11 @@ void Desktop::InitFinished() // GetCommandLineArgs() requires this code to work, otherwise it will abort, and // on Unix command line args needs to be checked before Desktop::Init() -void Desktop::CreateProcessServiceFactory() +void Desktop::ensureProcessServiceFactory() { + if( ::comphelper::getProcessServiceFactory().is()) + return; + Reference < XMultiServiceFactory > rSMgr = CreateApplicationServiceManager(); if( rSMgr.is() ) { diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx index 1e72fa121423..14c044e82a23 100644 --- a/desktop/source/app/sofficemain.cxx +++ b/desktop/source/app/sofficemain.cxx @@ -49,7 +49,6 @@ extern "C" int soffice_main() desktop::Desktop aDesktop; // This string is used during initialization of the Gtk+ VCL module aDesktop.SetAppName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("soffice")) ); - aDesktop.CreateProcessServiceFactory(); #ifdef UNX // handle --version and --help already here, otherwise they would be handled // after VCL initialization that might fail if $DISPLAY is not set |