diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-11-13 17:53:42 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-11-13 18:04:26 +0100 |
commit | 12fa9ece663f24eff44197befe546a92e6c90724 (patch) | |
tree | a09c9b7844a5c8298d81c9b4934acc36f9c8b28b /unotools | |
parent | 4be8c3205afd55fa7e1f578384d3c91ebd8b5ec3 (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 'unotools')
-rw-r--r-- | unotools/source/config/useroptions.cxx | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx index 8af1121f9e42..5da601831adb 100644 --- a/unotools/source/config/useroptions.cxx +++ b/unotools/source/config/useroptions.cxx @@ -51,29 +51,27 @@ using rtl::OUString; namespace { -OUString const sData = "org.openoffice.UserProfile/Data"; - // vOptionNames[] -- names of the user option entries // The order corresponds to the #define USER_OPT_* list in useroptions.hxx. -OUString const vOptionNames[] = { - OUString("l"), // USER_OPT_CITY - OUString("o"), // USER_OPT_COMPANY - OUString("c"), // USER_OPT_COUNTRY - OUString("mail"), // USER_OPT_EMAIL - OUString("facsimiletelephonenumber"), // USER_OPT_FAX - OUString("givenname"), // USER_OPT_FIRSTNAME - OUString("sn"), // USER_OPT_LASTNAME - OUString("position"), // USER_OPT_POSITION - OUString("st"), // USER_OPT_STATE - OUString("street"), // USER_OPT_STREET - OUString("homephone"), // USER_OPT_TELEPHONEHOME - OUString("telephonenumber"), // USER_OPT_TELEPHONEWORK - OUString("title"), // USER_OPT_TITLE - OUString("initials"), // USER_OPT_ID - OUString("postalcode"), // USER_OPT_ZIP - OUString("fathersname"), // USER_OPT_FATHERSNAME - OUString("apartment"), // USER_OPT_APARTMENT - OUString("customernumber") // USER_OPT_CUSTOMERNUMBER +char const * const vOptionNames[] = { + "l", // USER_OPT_CITY + "o", // USER_OPT_COMPANY + "c", // USER_OPT_COUNTRY + "mail", // USER_OPT_EMAIL + "facsimiletelephonenumber", // USER_OPT_FAX + "givenname", // USER_OPT_FIRSTNAME + "sn", // USER_OPT_LASTNAME + "position", // USER_OPT_POSITION + "st", // USER_OPT_STATE + "street", // USER_OPT_STREET + "homephone", // USER_OPT_TELEPHONEHOME + "telephonenumber", // USER_OPT_TELEPHONEWORK + "title", // USER_OPT_TITLE + "initials", // USER_OPT_ID + "postalcode", // USER_OPT_ZIP + "fathersname", // USER_OPT_FATHERSNAME + "apartment", // USER_OPT_APARTMENT + "customernumber" // USER_OPT_CUSTOMERNUMBER }; const sal_uInt16 nOptionNameCount = SAL_N_ELEMENTS(vOptionNames); @@ -147,7 +145,7 @@ SvtUserOptions::Impl::Impl() : m_xCfg = uno::Reference<container::XNameAccess>( comphelper::ConfigurationHelper::openConfig( comphelper::getProcessComponentContext(), - sData, + "org.openoffice.UserProfile/Data", comphelper::ConfigurationHelper::E_STANDARD ), uno::UNO_QUERY @@ -180,7 +178,7 @@ OUString SvtUserOptions::Impl::GetToken (sal_uInt16 nToken) const try { if (m_xData.is()) - m_xData->getPropertyValue(vOptionNames[nToken]) >>= sToken; + m_xData->getPropertyValue(OUString::createFromAscii(vOptionNames[nToken])) >>= sToken; } catch (uno::Exception const& ex) { @@ -201,7 +199,7 @@ void SvtUserOptions::Impl::SetToken (sal_uInt16 nToken, OUString const& sToken) try { if (m_xData.is()) - m_xData->setPropertyValue(vOptionNames[nToken], uno::makeAny(sToken)); + m_xData->setPropertyValue(OUString::createFromAscii(vOptionNames[nToken]), uno::makeAny(sToken)); comphelper::ConfigurationHelper::flush(m_xCfg); } catch (uno::Exception const& ex) @@ -240,7 +238,7 @@ sal_Bool SvtUserOptions::Impl::IsTokenReadonly (sal_uInt16 nToken) const { uno::Reference<beans::XPropertySet> xData(m_xCfg, uno::UNO_QUERY); uno::Reference<beans::XPropertySetInfo> xInfo = xData->getPropertySetInfo(); - beans::Property aProp = xInfo->getPropertyByName(vOptionNames[nToken]); + beans::Property aProp = xInfo->getPropertyByName(OUString::createFromAscii(vOptionNames[nToken])); return ((aProp.Attributes & beans::PropertyAttribute::READONLY) == beans::PropertyAttribute::READONLY); } |