This is an automated email from the ASF dual-hosted git repository. jim pushed a commit to branch AOO42X in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push: new 3664e17 revert updated code due to Winbot breakage 3664e17 is described below commit 3664e17d47035a5c5bbae79cb09834b39bf5e2bb Author: Jim Jagielski <jim...@gmail.com> AuthorDate: Thu Dec 3 07:18:10 2020 -0500 revert updated code due to Winbot breakage (cherry picked from commit 8adbddbad04dcb7e8f2efd99759f19f7e7967851) --- 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; } }