Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


So the ooo3migration thing was a red herring alright, so here's my
second stab at fdo#37195

http://cgit.freedesktop.org/libreoffice/core/commit/?id=a78a6e013b8d97891aa2b9c9a5dce64a82dc2f06

a) If CreateProcessServiceFactory is called, then common.rdb of
"Users/YOU/AppData/Roaming/LibreOffice/3/user/extensions/bundled/registry/
com.sun.star.comp.deployment.component.PackageRegistryBackend/common.rdb" is opened mmapped on 
windows

b) On a new start of an LibreOffice which wants to synchronize new
config over an old config, then it will want do a copy of
"install/share/prereg/bundled/registry/
com.sun.star.comp.deployment.component.PackageRegistryBackend/common.rdb"
over
"Users/YOU/AppData/Roaming/LibreOffice/3/user/extensions/bundled/registry/
com.sun.star.comp.deployment.component.PackageRegistryBackend/common.rdb"
which will fail on windows with error 1224, i.e. ERROR_USER_MAPPED_FILE

c) That aborts the copy_bundled_recursive copy, leaving an old config
pointing to the old location of dictionaries.

d) So for windows at least, CreateProcessServiceFactory shouldn't happen
before copy_bundled_recursive.

This appears to be a (wildly unexpected and impossible to predict)
side-effect of c3ccdabb where it happened to be the case in the past
that CreateProcessServiceFactory didn't get called before
synchronization under windows.

Attached is the backport for 3-4 as this code changed a little between
3-4 and master.

caolanm->Andras: could you arrange to have the attached tested ?

C.
From f9036d7c0b6b8ee00de618f33083ec11cc0e1c7f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Thu, 1 Sep 2011 13:43:35 +0100
Subject: [PATCH] Resolves: fdo#37195 CreateProcessServiceFactory can't happen
 before sync

If CreateProcessServiceFactory is called, then common.rdb of
"Users/YOU/AppData/Roaming/LibreOffice/3/user/extensions/bundled/registry/
com.sun.star.comp.deployment.component.PackageRegistryBackend/common.rdb" is
opened mmapped

On a new start of an LibreOffice which wants to synchronize new config over an
old config, then it will want do a copy of
"install/share/prereg/bundled/registry/
com.sun.star.comp.deployment.component.PackageRegistryBackend/common.rdb"
over
"Users/YOU/AppData/Roaming/LibreOffice/3/user/extensions/bundled/registry/
com.sun.star.comp.deployment.component.PackageRegistryBackend/common.rdb"
which will fail on windows with error 1224, i.e. ERROR_USER_MAPPED_FILE

That aborts the copy_bundled_recursive copy, leaving an old config
pointing to the old location of dictionaries.

So for windows at least, CreateProcessServiceFactory shouldn't happen before
copy_bundled_recursive.
---
 desktop/inc/app.hxx                |    4 ++--
 desktop/source/app/app.cxx         |   17 +++++++++++++++--
 desktop/source/app/sofficemain.cxx |    1 -
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index 7f9a7ef..e13283d 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -139,11 +139,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 873588d..1a8fb2f 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -322,7 +322,10 @@ CommandLineArgs* Desktop::GetCommandLineArgs()
     {
         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
         if ( !pArgs )
+        {
+            ensureProcessServiceFactory();
             pArgs = new CommandLineArgs;
+        }
     }
 
     return pArgs;
@@ -711,8 +714,15 @@ void Desktop::Init()
             copy_bundled_recursive( aPreregBundledPath, aUserPath, +1 );
         }
     }
-    
+
     // 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().");
@@ -764,8 +774,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 1e640c5..214fcdf 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
-- 
1.7.6


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.