[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - desktop/source vcl/source

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Fri May 10 14:36:23 UTC 2019


 desktop/source/lib/init.cxx |   27 +++++++++------------------
 vcl/source/app/svmain.cxx   |    6 ++++++
 2 files changed, 15 insertions(+), 18 deletions(-)

New commits:
commit d48b54144b464a41bdc9cca8a8d766cc6aa525c2
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu May 9 18:24:18 2019 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 10 16:35:45 2019 +0200

    unipoll: let InitVCL tolerate double init.
    
    We need to get VCL initialized early in UniPoll mode, since the main
    setup doesn't occur until runPoll is invoked, and we want to call lots
    of virtual methods that take the SolarMutex before then - which requires
    VCL to be initialized.
    
    Change-Id: Id9c1b74c126cf7bb71d6560b7585d37327a9f5ef
    Reviewed-on: https://gerrit.libreoffice.org/72069
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 626e37b87a1f..ba8ebed87b04 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4974,24 +4974,6 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
             force_c_locale();
         }
 
-        // We could use InitVCL() here -- and used to before using soffice_main,
-        // however that now deals with the initialisation for us (and it's not
-        // possible to try to set up VCL twice.
-
-        // Instead VCL init is done for us by soffice_main in a separate thread,
-        // however we specifically can't proceed until this setup is complete
-        // (or you get segfaults trying to use VCL and/or deadlocks due to other
-        //  setup within soffice_main). Specifically the various Application::
-        // functions depend on VCL being ready -- the deadlocks would happen
-        // if you try to use loadDocument too early.
-
-        // The RequestHandler is specifically set to be ready when all the other
-        // init in Desktop::Main (run from soffice_main) is done. We can enable
-        // the RequestHandler here (without starting any IPC thread;
-        // shortcutting the invocation in Desktop::Main that would start the IPC
-        // thread), and can then use it to wait until we're definitely ready to
-        // continue.
-
         if (eStage != PRE_INIT)
         {
             SAL_INFO("lok", "Re-initialize temp paths");
@@ -5001,6 +4983,13 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
             aOptions.SetTempPath(aNewTemp);
             desktop::Desktop::CreateTemporaryDirectory();
 
+            // The RequestHandler is specifically set to be ready when all the other
+            // init in Desktop::Main (run from soffice_main) is done. We can enable
+            // the RequestHandler here (without starting any IPC thread;
+            // shortcutting the invocation in Desktop::Main that would start the IPC
+            // thread), and can then use it to wait until we're definitely ready to
+            // continue.
+
             SAL_INFO("lok", "Enabling RequestHandler");
             RequestHandler::Enable(false);
             SAL_INFO("lok", "Starting soffice_main");
@@ -5013,6 +5002,8 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
                 RequestHandler::WaitForReady();
                 SAL_INFO("lok", "RequestHandler ready -- continuing");
             }
+            else
+                InitVCL();
         }
 
         if (eStage != SECOND_INIT)
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index cbf2f6b63054..e67197a0e0c8 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -376,6 +376,12 @@ namespace vclmain
 
 bool InitVCL()
 {
+    if (isInitVCL())
+    {
+        SAL_INFO("vcl.app", "Double initialization of vcl");
+        return true;
+    }
+
     if( pExceptionHandler != nullptr )
         return false;
 


More information about the Libreoffice-commits mailing list