summaryrefslogtreecommitdiff
path: root/cppu/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-11-13 17:53:42 +0100
committerStephan Bergmann <sbergman@redhat.com>2012-11-13 18:04:26 +0100
commit12fa9ece663f24eff44197befe546a92e6c90724 (patch)
treea09c9b7844a5c8298d81c9b4934acc36f9c8b28b /cppu/source
parent4be8c3205afd55fa7e1f578384d3c91ebd8b5ec3 (diff)
Avoid global static data
...that (indirectly) allocates memory via rtl/alloc.h, thereby causing the rtl_cache_wsupdate_init thread to be spawned before main, as on Mac OS X that would interfere with the code in sal_detail_initialize to close all file descriptors >= 3 -- on Mac OS X the pthreads implementation makes use of KQUEUE file descriptors. * This commit removes enough global static data to make ui-preview work again on Mac OS X (where it crashed at startup when the main thread closed the KQUEUE fd used by pthreads implementation threads). gengal uses further static data (at least from module sb), so needs further clean-up. * Avoiding global static instances derived from class Application required the introduction of vcl/vclmain.hxx. * That the vcl library was linked against the static vclmain library (which only provides an implementation of main) appears to me to be a historic relic (all executables should either include a SAL_IMPLEMENT_MAIN or link against vclmain), so I removed that. Change-Id: I048aa616208cb3a1b9bd8dcc3b729ba1665729bd
Diffstat (limited to 'cppu/source')
-rw-r--r--cppu/source/uno/EnvStack.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/cppu/source/uno/EnvStack.cxx b/cppu/source/uno/EnvStack.cxx
index f4521c3bdeda..cafd4fe23b75 100644
--- a/cppu/source/uno/EnvStack.cxx
+++ b/cppu/source/uno/EnvStack.cxx
@@ -67,8 +67,6 @@ namespace
struct s_threadMap : public rtl::Static< ThreadMap, s_threadMap > {};
}
-static rtl::OUString s_uno_envDcp(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO));
-
static void s_setCurrent(uno_Environment * pEnv)
{
oslThreadIdentifier threadId = osl_getThreadIdentifier(NULL);
@@ -128,8 +126,10 @@ extern "C" CPPU_DLLPUBLIC void SAL_CALL uno_getCurrentEnvironment(uno_Environmen
(*ppEnv)->acquire(*ppEnv);
}
else
- uno_getEnvironment(ppEnv, s_uno_envDcp.pData, NULL);
-
+ {
+ rtl::OUString uno_envDcp(UNO_LB_UNO);
+ uno_getEnvironment(ppEnv, uno_envDcp.pData, NULL);
+ }
}
}
@@ -196,7 +196,7 @@ static int s_getNextEnv(uno_Environment ** ppEnv, uno_Environment * pCurrEnv, un
if (!nextPurpose.isEmpty())
{
- rtl::OUString next_envDcp(s_uno_envDcp);
+ rtl::OUString next_envDcp(UNO_LB_UNO);
next_envDcp += nextPurpose;
uno_getEnvironment(ppEnv, next_envDcp.pData, NULL);
@@ -355,7 +355,7 @@ CPPU_DLLPUBLIC int SAL_CALL uno_Environment_isValid(uno_Environment * pEnv, rtl_
int result = 1;
rtl::OUString typeName(cppu::EnvDcp::getTypeName(pEnv->pTypeName));
- if (typeName.equals(s_uno_envDcp))
+ if (typeName == UNO_LB_UNO)
{
cppu::Enterable * pEnterable = reinterpret_cast<cppu::Enterable *>(pEnv->pReserved);
if (pEnterable)
@@ -363,7 +363,7 @@ CPPU_DLLPUBLIC int SAL_CALL uno_Environment_isValid(uno_Environment * pEnv, rtl_
}
else
{
- rtl::OUString envDcp(s_uno_envDcp);
+ rtl::OUString envDcp(UNO_LB_UNO);
envDcp += cppu::EnvDcp::getPurpose(pEnv->pTypeName);
uno::Environment env(envDcp);