You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ji...@apache.org on 2020/12/03 12:19:15 UTC

[openoffice] branch trunk updated: revert updated code due to Winbot breakage

This is an automated email from the ASF dual-hosted git repository.

jim pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 8adbddb  revert updated code due to Winbot breakage
8adbddb is described below

commit 8adbddbad04dcb7e8f2efd99759f19f7e7967851
Author: Jim Jagielski <ji...@gmail.com>
AuthorDate: Thu Dec 3 07:18:10 2020 -0500

    revert updated code due to Winbot breakage
---
 main/bridges/source/cpp_uno/shared/component.cxx | 44 +++++++++++++++++-------
 1 file changed, 32 insertions(+), 12 deletions(-)

diff --git a/main/bridges/source/cpp_uno/shared/component.cxx b/main/bridges/source/cpp_uno/shared/component.cxx
index da729d4..dfa5a8d 100644
--- a/main/bridges/source/cpp_uno/shared/component.cxx
+++ b/main/bridges/source/cpp_uno/shared/component.cxx
@@ -53,22 +53,42 @@ rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT;
 
 namespace {
 
+#if (defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)) \
+    || (defined(__GNUC__) && defined(__APPLE__))
+static ::rtl::OUString * s_pStaticOidPart = 0;
+#endif
+
 const ::rtl::OUString & SAL_CALL cppu_cppenv_getStaticOIdPart() SAL_THROW( () )
 {
-    static ::rtl::OUString s_aStaticOidPart = []() {
-        ::rtl::OUStringBuffer aRet( 64 );
-        aRet.appendAscii( RTL_CONSTASCII_STRINGPARAM("];") );
-        // good guid
-        sal_uInt8 ar[16];
-        ::rtl_getGlobalProcessId(ar);
-        for ( sal_Int32 i = 0; i < 16; ++i )
+#if ! ((defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)) \
+    || (defined(__GNUC__) && defined(__APPLE__)))
+    static ::rtl::OUString * s_pStaticOidPart = 0;
+#endif
+    if (! s_pStaticOidPart)
+    {
+        ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+        if (! s_pStaticOidPart)
         {
-            aRet.append( (sal_Int32)ar[i], 16 );
+            ::rtl::OUStringBuffer aRet( 64 );
+            aRet.appendAscii( RTL_CONSTASCII_STRINGPARAM("];") );
+            // good guid
+            sal_uInt8 ar[16];
+            ::rtl_getGlobalProcessId( ar );
+            for ( sal_Int32 i = 0; i < 16; ++i )
+            {
+                aRet.append( (sal_Int32)ar[i], 16 );
+            }
+#if (defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)) \
+    || (defined(__GNUC__) && defined(__APPLE__))
+            s_pStaticOidPart = new ::rtl::OUString( aRet.makeStringAndClear() );
+#else
+            static ::rtl::OUString s_aStaticOidPart(
+                aRet.makeStringAndClear() );
+            s_pStaticOidPart = &s_aStaticOidPart;
+#endif
         }
-        return aRet.makeStringAndClear();
-    }();
-    return s_aStaticOidPart;
-
+    }
+    return *s_pStaticOidPart;
 }
 
 }