[Libreoffice-commits] .: Branch 'libreoffice-3-6' - 3 commits - cppuhelper/source desktop/source sw/source

Michael Stahl mst at kemper.freedesktop.org
Fri Aug 10 04:27:42 PDT 2012


 cppuhelper/source/defaultbootstrap.cxx |  101 ++++++++++++++++++---------------
 desktop/source/app/app.cxx             |    4 +
 sw/source/ui/misc/redlndlg.cxx         |    2 
 3 files changed, 61 insertions(+), 46 deletions(-)

New commits:
commit 298b8c500a143211d122046075254c621571e7c8
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Aug 10 09:06:08 2012 +0200

    fdo#42470: Do not show backing window on --nodefault
    
    Change-Id: Id265dc84de454568ea8194703687c68449e9a32b
    (cherry picked from commit 0cfed166261968068abbed485ceffd67ca5cbf61)
    
    Signed-off-by: Michael Stahl <mstahl at redhat.com>

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 66e809b..263ca3f 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -2988,6 +2988,10 @@ void Desktop::DoFirstRunInitializations()
 
 void Desktop::ShowBackingComponent(Desktop * progress)
 {
+    if (GetCommandLineArgs().IsNoDefault())
+    {
+        return;
+    }
     Reference< XMultiServiceFactory > xSMgr(
         comphelper::getProcessServiceFactory(), UNO_SET_THROW);
     Reference< XFrame > xDesktopFrame(
commit fdcd1655b1648f078289c5ac8a1c075c71e6e6df
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Aug 9 17:44:14 2012 +0200

    Related fdo#52639: Do not destroy Implementations with mutex locked
    
    Erasing from data_ member maps can destroy contained Implementations, which in
    turn releases the UNO objects referenced from there, which in turn can cause
    XComponents to dispose, which in turn can call arbitrary code, so must not be
    done with rMutex locked.  Witness the backtrace at
    <https://bugs.freedesktop.org/attachment.cgi?id=65142> linked from fdo#52639
    (where this fix appears otherwise unrelated to that issue's main topic).
    
    Change-Id: If55a3841b761ec1d9a0ef61fe54784426c4ee442
    (cherry picked from commit 142d3ec875b446b56d0071c59d00937dea0cdd61)
    
    Signed-off-by: Michael Stahl <mstahl at redhat.com>

diff --git a/cppuhelper/source/defaultbootstrap.cxx b/cppuhelper/source/defaultbootstrap.cxx
index 151a36e..c3bdba3 100644
--- a/cppuhelper/source/defaultbootstrap.cxx
+++ b/cppuhelper/source/defaultbootstrap.cxx
@@ -1346,7 +1346,7 @@ void ServiceManager::disposing(css::lang::EventObject const & Source)
 
 void ServiceManager::disposing() {
     std::vector< css::uno::Reference< css::lang::XComponent > > comps;
-    css::uno::Reference< css::lang::XEventListener > listener;
+    Data clear;
     {
         osl::MutexGuard g(rBHelper.rMutex);
         for (DynamicImplementations::const_iterator i(
@@ -1358,10 +1358,10 @@ void ServiceManager::disposing() {
                 comps.push_back(i->second->component);
             }
         }
-        data_.namedImplementations.clear();
-        data_.dynamicImplementations.clear();
-        data_.services.clear();
-        data_.singletons.clear();
+        data_.namedImplementations.swap(clear.namedImplementations);
+        data_.dynamicImplementations.swap(clear.dynamicImplementations);
+        data_.services.swap(clear.services);
+        data_.singletons.swap(clear.singletons);
     }
     for (std::vector<
              css::uno::Reference< css::lang::XComponent > >::const_iterator i(
@@ -1733,25 +1733,30 @@ void ServiceManager::removeRdbFiles(std::vector< rtl::OUString > const & uris) {
     // The underlying data structures make this function somewhat inefficient,
     // but the assumption is that it is rarely called (and that if it is called,
     // it is called with a uris vector of size one):
-    osl::MutexGuard g(rBHelper.rMutex);
-    for (std::vector< rtl::OUString >::const_iterator i(uris.begin());
-         i != uris.end(); ++i)
+    std::vector< boost::shared_ptr< Implementation > > clear;
     {
-        for (NamedImplementations::iterator j(
-                 data_.namedImplementations.begin());
-             j != data_.namedImplementations.end();)
+        osl::MutexGuard g(rBHelper.rMutex);
+        for (std::vector< rtl::OUString >::const_iterator i(uris.begin());
+             i != uris.end(); ++i)
         {
-            assert(j->second.get() != 0);
-            if (j->second->info->uri == *i) {
-                //TODO: The below leaves data_ in an inconsistent state upon
-                // exceptions:
-                removeFromImplementationMap(
-                    &data_.services, j->second->info->services, j->second);
-                removeFromImplementationMap(
-                    &data_.singletons, j->second->info->singletons, j->second);
-                data_.namedImplementations.erase(j++);
-            } else {
-                ++j;
+            for (NamedImplementations::iterator j(
+                     data_.namedImplementations.begin());
+                 j != data_.namedImplementations.end();)
+            {
+                assert(j->second.get() != 0);
+                if (j->second->info->uri == *i) {
+                    clear.push_back(j->second);
+                    //TODO: The below leaves data_ in an inconsistent state upon
+                    // exceptions:
+                    removeFromImplementationMap(
+                        &data_.services, j->second->info->services, j->second);
+                    removeFromImplementationMap(
+                        &data_.singletons, j->second->info->singletons,
+                        j->second);
+                    data_.namedImplementations.erase(j++);
+                } else {
+                    ++j;
+                }
             }
         }
     }
@@ -1763,6 +1768,7 @@ bool ServiceManager::removeLegacyFactory(
     bool removeListener)
 {
     assert(factoryInfo.is());
+    boost::shared_ptr< Implementation > clear;
     css::uno::Reference< css::lang::XComponent > comp;
     {
         osl::MutexGuard g(rBHelper.rMutex);
@@ -1772,6 +1778,7 @@ bool ServiceManager::removeLegacyFactory(
             return isDisposed();
         }
         assert(i->second.get() != 0);
+        clear = i->second;
         //TODO: The below leaves data_ in an inconsistent state upon exceptions:
         removeFromImplementationMap(
             &data_.services, i->second->info->services, i->second);
@@ -1794,32 +1801,36 @@ bool ServiceManager::removeLegacyFactory(
 void ServiceManager::removeImplementation(rtl::OUString name) {
     // The underlying data structures make this function somewhat inefficient,
     // but the assumption is that it is rarely called:
-    osl::MutexGuard g(rBHelper.rMutex);
-    if (isDisposed()) {
-        return;
-    }
-    NamedImplementations::iterator i(data_.namedImplementations.find(name));
-    if (i == data_.namedImplementations.end()) {
-        throw css::container::NoSuchElementException(
-            "Remove non-inserted implementation " + name,
-            static_cast< cppu::OWeakObject * >(this));
-    }
-    assert(i->second.get() != 0);
-    //TODO: The below leaves data_ in an inconsistent state upon exceptions:
-    removeFromImplementationMap(
-        &data_.services, i->second->info->services, i->second);
-    removeFromImplementationMap(
-        &data_.singletons, i->second->info->singletons, i->second);
-    for (DynamicImplementations::iterator j(
-             data_.dynamicImplementations.begin());
-         j != data_.dynamicImplementations.end(); ++j)
+    boost::shared_ptr< Implementation > clear;
     {
-        if (j->second == i->second) {
-            data_.dynamicImplementations.erase(j);
-            break;
+        osl::MutexGuard g(rBHelper.rMutex);
+        if (isDisposed()) {
+            return;
+        }
+        NamedImplementations::iterator i(data_.namedImplementations.find(name));
+        if (i == data_.namedImplementations.end()) {
+            throw css::container::NoSuchElementException(
+                "Remove non-inserted implementation " + name,
+                static_cast< cppu::OWeakObject * >(this));
+        }
+        assert(i->second.get() != 0);
+        clear = i->second;
+        //TODO: The below leaves data_ in an inconsistent state upon exceptions:
+        removeFromImplementationMap(
+            &data_.services, i->second->info->services, i->second);
+        removeFromImplementationMap(
+            &data_.singletons, i->second->info->singletons, i->second);
+        for (DynamicImplementations::iterator j(
+                 data_.dynamicImplementations.begin());
+             j != data_.dynamicImplementations.end(); ++j)
+        {
+            if (j->second == i->second) {
+                data_.dynamicImplementations.erase(j);
+                break;
+            }
         }
+        data_.namedImplementations.erase(i);
     }
-    data_.namedImplementations.erase(i);
 }
 
 boost::shared_ptr< Implementation > ServiceManager::findServiceImplementation(
commit 9f89b3dc6301f85ffbb55b526eb2d0f69512e51a
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Aug 7 20:58:22 2012 +0200

    fdo#51832: SwRedlineAcceptDlg: fix STL conversion:
    
    62b7606fddfef9e1a7645a2d3d605f1fa3aee263 wrongly converted the call to
    aRedlineParents.DeleteAndDestroy() in
    SwRedlineAcceptDlg::RemoveParents() and erases one element less than
    the old code, which results in access to deleted SvListEntry and crash.
    
    (cherry picked from commit 8a66a7789698b12f2c07169e0106413de2f39fb8)
    
    Change-Id: Ie2749cb3f17b36649adff46c166642fccde31329
    Signed-off-by: Tor Lillqvist <tml at iki.fi>

diff --git a/sw/source/ui/misc/redlndlg.cxx b/sw/source/ui/misc/redlndlg.cxx
index ae65e1f..e902961 100644
--- a/sw/source/ui/misc/redlndlg.cxx
+++ b/sw/source/ui/misc/redlndlg.cxx
@@ -723,7 +723,7 @@ void SwRedlineAcceptDlg::RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd)
     // unfortunately by Remove it was selected from the TLB always again ...
     pTable->SelectAll(sal_False);
 
-    aRedlineParents.erase( aRedlineParents.begin() + nStart, aRedlineParents.begin() + nEnd);
+    aRedlineParents.erase( aRedlineParents.begin() + nStart, aRedlineParents.begin() + nEnd + 1);
 }
 
 void SwRedlineAcceptDlg::InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd)


More information about the Libreoffice-commits mailing list