kbrown / rpms / libreoffice

Forked from rpms/libreoffice 2 years ago
Clone

Blame SOURCES/0002-vcl-add-isInitVCL-to-not-initialize-twice.patch

135360
From ae536d948c00a5561f7d08f2f7459516d8bf9807 Mon Sep 17 00:00:00 2001
135360
From: Henry Castro <hcastro@collabora.com>
135360
Date: Mon, 7 Sep 2015 17:33:09 -0400
135360
Subject: [PATCH 2/6] vcl: add isInitVCL, to not initialize twice
135360
135360
In the preinit stage, the VCL is initialized in the parent process
135360
and when the lo_startmain thread is started, the thread initialize
135360
VCL again.
135360
135360
It is not necessary to initialize twice.
135360
135360
Change-Id: I819cf0125afe7760c3f4d91c420d36a3a383902c
135360
(cherry picked from commit bc8dfe47596f28ff43ec01af4487a2abe349caee)
135360
---
135360
 vcl/source/app/svmain.cxx | 12 +++++++++++-
135360
 1 file changed, 11 insertions(+), 1 deletion(-)
135360
135360
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
135360
index 3202019..f6d4e25 100644
135360
--- a/vcl/source/app/svmain.cxx
135360
+++ b/vcl/source/app/svmain.cxx
135360
@@ -91,6 +91,8 @@
135360
 
135360
 using namespace ::com::sun::star;
135360
 
135360
+static bool isInitVCL();
135360
+
135360
 oslSignalAction SAL_CALL VCLExceptionSignal_impl( void* /*pData*/, oslSignalInfo* pInfo)
135360
 {
135360
     static bool bIn = false;
135360
@@ -160,7 +162,7 @@ int ImplSVMain()
135360
 
135360
     int nReturn = EXIT_FAILURE;
135360
 
135360
-    bool bInit = InitVCL();
135360
+    bool bInit = (!isInitVCL() ? InitVCL() : true);
135360
 
135360
     if( bInit )
135360
     {
135360
@@ -243,6 +245,14 @@ uno::Any SAL_CALL DesktopEnvironmentContext::getValueByName( const OUString& Nam
135360
     return retVal;
135360
 }
135360
 
135360
+static bool isInitVCL()
135360
+{
135360
+    ImplSVData* pSVData = ImplGetSVData();
135360
+    return  pExceptionHandler != NULL &&
135360
+            pSVData->mpApp != NULL &&
135360
+            pSVData->mpDefInst != NULL;
135360
+}
135360
+
135360
 bool InitVCL()
135360
 {
135360
     if( pExceptionHandler != NULL )
135360
-- 
135360
2.9.3
135360