[PATCH libreoffice-4-0] rhbz#908819: Don't call code in UNO object ctor that throws ...

Stephan Bergmann (via Code Review) gerrit at gerrit.libreoffice.org
Thu Jun 6 01:22:29 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/4172

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/72/4172/1

rhbz#908819: Don't call code in UNO object ctor that throws UNO exceptions

...with Context set to this, that leads to refcounting bugs.  This is a backport
of the relevant parts of 4e42ce3271154904b7478b9ed5e6e6856b9235c2 "Don't call
code in UNO object ctor that throws UNO exceptions."

Change-Id: Ie6fdf92fdf537b752cd05ed69c3b59f2c7795e28
---
M cppuhelper/source/defaultbootstrap.cxx
1 file changed, 5 insertions(+), 4 deletions(-)



diff --git a/cppuhelper/source/defaultbootstrap.cxx b/cppuhelper/source/defaultbootstrap.cxx
index 1fe1aa7..c61c2b0 100644
--- a/cppuhelper/source/defaultbootstrap.cxx
+++ b/cppuhelper/source/defaultbootstrap.cxx
@@ -589,12 +589,12 @@
     private osl::Mutex, public ServiceManagerBase, private boost::noncopyable
 {
 public:
-    explicit ServiceManager(rtl::OUString const & rdbUris):
-        ServiceManagerBase(*static_cast< osl::Mutex * >(this))
-    { readRdbs(rdbUris); }
+    ServiceManager(): ServiceManagerBase(*static_cast< osl::Mutex * >(this)) {}
 
     using ServiceManagerBase::acquire;
     using ServiceManagerBase::release;
+
+    void init(rtl::OUString const & rdbUris) { readRdbs(rdbUris); }
 
     void setContext(
         css::uno::Reference< css::uno::XComponentContext > const & context)
@@ -1985,7 +1985,8 @@
     css::uno::Reference< css::registry::XSimpleRegistry > const & typeRegistry,
     rtl::OUString const & serviceUris, rtl::Bootstrap const & bootstrap)
 {
-    rtl::Reference< ServiceManager > smgr(new ServiceManager(serviceUris));
+    rtl::Reference< ServiceManager > smgr(new ServiceManager);
+    smgr->init(serviceUris);
     cppu::ContextEntry_Init entry;
     std::vector< cppu::ContextEntry_Init > context_values;
     context_values.push_back(

-- 
To view, visit https://gerrit.libreoffice.org/4172
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie6fdf92fdf537b752cd05ed69c3b59f2c7795e28
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Stephan Bergmann <sbergman at redhat.com>



More information about the LibreOffice mailing list