[Libreoffice-commits] core.git: desktop/source vcl/source

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


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

New commits:
commit e655dc8bbf010e5ef89c32c2ebde56281b323925
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu May 9 18:24:18 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri May 10 16:19:34 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/72071
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 339bda480f5f..7b46ee397904 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4885,24 +4885,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");
@@ -4912,6 +4894,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");
@@ -4924,6 +4913,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 9372e74afc17..16b83439751b 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -294,6 +294,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