Blob Blame History Raw
From ae536d948c00a5561f7d08f2f7459516d8bf9807 Mon Sep 17 00:00:00 2001
From: Henry Castro <hcastro@collabora.com>
Date: Mon, 7 Sep 2015 17:33:09 -0400
Subject: [PATCH 2/6] vcl: add isInitVCL, to not initialize twice

In the preinit stage, the VCL is initialized in the parent process
and when the lo_startmain thread is started, the thread initialize
VCL again.

It is not necessary to initialize twice.

Change-Id: I819cf0125afe7760c3f4d91c420d36a3a383902c
(cherry picked from commit bc8dfe47596f28ff43ec01af4487a2abe349caee)
---
 vcl/source/app/svmain.cxx | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 3202019..f6d4e25 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -91,6 +91,8 @@
 
 using namespace ::com::sun::star;
 
+static bool isInitVCL();
+
 oslSignalAction SAL_CALL VCLExceptionSignal_impl( void* /*pData*/, oslSignalInfo* pInfo)
 {
     static bool bIn = false;
@@ -160,7 +162,7 @@ int ImplSVMain()
 
     int nReturn = EXIT_FAILURE;
 
-    bool bInit = InitVCL();
+    bool bInit = (!isInitVCL() ? InitVCL() : true);
 
     if( bInit )
     {
@@ -243,6 +245,14 @@ uno::Any SAL_CALL DesktopEnvironmentContext::getValueByName( const OUString& Nam
     return retVal;
 }
 
+static bool isInitVCL()
+{
+    ImplSVData* pSVData = ImplGetSVData();
+    return  pExceptionHandler != NULL &&
+            pSVData->mpApp != NULL &&
+            pSVData->mpDefInst != NULL;
+}
+
 bool InitVCL()
 {
     if( pExceptionHandler != NULL )
-- 
2.9.3