Kaydet (Commit) 4e42ce32 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Don't call code in UNO object ctor that throws UNO exceptions

...with Context set to this, that leads to refcounting bugs.

Change-Id: I4875dbe4ccb5a7bcfaa8370b14d4eab83c21d0e5
üst 56fa2d1b
...@@ -56,11 +56,10 @@ cppu::defaultBootstrap_InitialComponentContext(rtl::OUString const & iniUri) ...@@ -56,11 +56,10 @@ cppu::defaultBootstrap_InitialComponentContext(rtl::OUString const & iniUri)
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
rtl::Reference< cppuhelper::ServiceManager > smgr( rtl::Reference< cppuhelper::ServiceManager > smgr(
new cppuhelper::ServiceManager( new cppuhelper::ServiceManager);
getBootstrapVariable(bs, "UNO_SERVICES"))); smgr->init(getBootstrapVariable(bs, "UNO_SERVICES"));
rtl::Reference< cppuhelper::TypeManager > tmgr( rtl::Reference< cppuhelper::TypeManager > tmgr(new cppuhelper::TypeManager);
new cppuhelper::TypeManager( tmgr->init(getBootstrapVariable(bs, "UNO_TYPES"));
getBootstrapVariable(bs, "UNO_TYPES")));
cppu::ContextEntry_Init entry; cppu::ContextEntry_Init entry;
std::vector< cppu::ContextEntry_Init > context_values; std::vector< cppu::ContextEntry_Init > context_values;
context_values.push_back( context_values.push_back(
......
...@@ -129,13 +129,13 @@ public: ...@@ -129,13 +129,13 @@ public:
ImplementationMap singletons; ImplementationMap singletons;
}; };
explicit ServiceManager(rtl::OUString const & rdbUris): ServiceManager(): ServiceManagerBase(*static_cast< osl::Mutex * >(this)) {}
ServiceManagerBase(*static_cast< osl::Mutex * >(this))
{ readRdbs(rdbUris); }
using ServiceManagerBase::acquire; using ServiceManagerBase::acquire;
using ServiceManagerBase::release; using ServiceManagerBase::release;
void init(rtl::OUString const & rdbUris) { readRdbs(rdbUris); }
void setContext( void setContext(
css::uno::Reference< css::uno::XComponentContext > const & context) css::uno::Reference< css::uno::XComponentContext > const & context)
{ {
......
...@@ -1863,10 +1863,12 @@ void Enumeration::findNextMatch() { ...@@ -1863,10 +1863,12 @@ void Enumeration::findNextMatch() {
} }
cppuhelper::TypeManager::TypeManager(rtl::OUString const & rdbUris): cppuhelper::TypeManager::TypeManager():
TypeManager_Base(*static_cast< osl::Mutex * >(this)), TypeManager_Base(*static_cast< osl::Mutex * >(this)),
manager_(new unoidl::Manager) manager_(new unoidl::Manager)
{ {}
void cppuhelper::TypeManager::init(rtl::OUString const & rdbUris) {
readRdbs(rdbUris); readRdbs(rdbUris);
} }
......
...@@ -51,11 +51,13 @@ TypeManager_Base; ...@@ -51,11 +51,13 @@ TypeManager_Base;
class TypeManager: private osl::Mutex, public TypeManager_Base { class TypeManager: private osl::Mutex, public TypeManager_Base {
public: public:
explicit TypeManager(rtl::OUString const & rdbUris); TypeManager();
using TypeManager_Base::acquire; using TypeManager_Base::acquire;
using TypeManager_Base::release; using TypeManager_Base::release;
void init(rtl::OUString const & rdbUris);
css::uno::Any find(rtl::OUString const & name); css::uno::Any find(rtl::OUString const & name);
css::uno::Reference< css::reflection::XTypeDescription > resolve( css::uno::Reference< css::reflection::XTypeDescription > resolve(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment