[Libreoffice-commits] core.git: 3 commits - accessibility/source comphelper/source include/comphelper toolkit/source

David Ostrovsky david at ostrovsky.org
Fri Oct 4 05:52:18 PDT 2013


 accessibility/source/extended/AccessibleGridControl.cxx             |   33 +++++++---
 accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx |    6 +
 comphelper/source/misc/accessiblecomponenthelper.cxx                |   18 -----
 comphelper/source/misc/accessiblecontexthelper.cxx                  |    9 --
 include/comphelper/accessiblecomponenthelper.hxx                    |    3 
 include/comphelper/accessiblecontexthelper.hxx                      |    2 
 toolkit/source/awt/vclxtoolkit.cxx                                  |    1 
 toolkit/source/controls/accessiblecontrolcontext.cxx                |    3 
 8 files changed, 35 insertions(+), 40 deletions(-)

New commits:
commit 74403b790a50ee6185a607e9e48d87a061e123e9
Author: David Ostrovsky <david at ostrovsky.org>
Date:   Thu Oct 3 22:37:47 2013 +0200

    VCLXToolkit::reschedule(): lock SolarMutex
    
    ... otherwise Yield() will return with the SolarMutex not locked,
    triggering the assertion in ImplYield().
    
    Change-Id: I6e44ce95517702ff5f316f7ea1df3aefc31588f6

diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 4e3f6cd..e80f1bc 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -1747,6 +1747,7 @@ void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent,
 void SAL_CALL VCLXToolkit::reschedule()
     throw (::com::sun::star::uno::RuntimeException)
 {
+    SolarMutexGuard aSolarGuard;
     Application::Reschedule(true);
 }
 
commit 4fc7deb7b0528010ebf644654bf4a36594e03f8c
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Oct 3 23:16:34 2013 +0200

    fix STL assert in accessibility::AccessibleGridControl::commitTableEvent
    
    While running some JunitTest, crashes on an attempt to delete entries
    of an empty vector m_pImpl->m_pTable->m_pCellVector.
    
    The entries are created on-demand by
    AccessibleGridControlTable::getAccessibleChild(), so presumably that
    hadn't been called yet when the rows were deleted.
    
    Also fix bizarre abuse of all applicable variable naming conventions.
    
    (regression from 2095b2e1d44a158418d17836019352ed92f95d21)
    
    Change-Id: Id2d70ca4601a166718629c0fe922f805dd72eec1

diff --git a/accessibility/source/extended/AccessibleGridControl.cxx b/accessibility/source/extended/AccessibleGridControl.cxx
index 9c97e96..df7b8a0 100644
--- a/accessibility/source/extended/AccessibleGridControl.cxx
+++ b/accessibility/source/extended/AccessibleGridControl.cxx
@@ -337,11 +337,13 @@ void AccessibleGridControl::commitCellEvent(sal_Int16 _nEventId,const Any& _rNew
             com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessibleContext > xAccessibleChild = xAccessible->getAccessibleContext();
             if(m_pImpl->m_xTable == xAccessible)
             {
-                std::vector< AccessibleGridControlTableCell* > xCellCont = m_pImpl->m_pTable->getCellVector();
-                int nIndex = m_aTable.GetCurrentRow()*m_aTable.GetColumnCount()+m_aTable.GetCurrentColumn();
-                if(!xCellCont.empty() && xCellCont[nIndex])
+                std::vector< AccessibleGridControlTableCell* >& rCells =
+                    m_pImpl->m_pTable->getCellVector();
+                size_t nIndex = m_aTable.GetCurrentRow() * m_aTable.GetColumnCount()
+                              + m_aTable.GetCurrentColumn();
+                if (nIndex < rCells.size() && rCells[nIndex])
                 {
-                    m_pImpl->m_pCell = xCellCont[nIndex];
+                    m_pImpl->m_pCell = rCells[nIndex];
                     m_pImpl->m_pCell->commitEvent( _nEventId, _rNewValue, _rOldValue );
                 }
             }
@@ -370,11 +372,26 @@ void AccessibleGridControl::commitTableEvent(sal_Int16 _nEventId,const Any& _rNe
             {
                 if(aChange.Type == AccessibleTableModelChangeType::DELETE)
                 {
-                    std::vector< AccessibleGridControlTableCell* >::iterator m_pCell = m_pImpl->m_pTable->getCellVector().begin();
-                    std::vector< Reference< XAccessible > >::iterator m_xAccessibleVector = m_pImpl->m_pTable->getAccessibleCellVector().begin();
+                    std::vector< AccessibleGridControlTableCell* >& rCells =
+                        m_pImpl->m_pTable->getCellVector();
+                    std::vector< Reference< XAccessible > >& rAccCells =
+                        m_pImpl->m_pTable->getAccessibleCellVector();
                     int nColCount = m_aTable.GetColumnCount();
-                    m_pImpl->m_pTable->getCellVector().erase(m_pCell+nColCount*aChange.FirstRow, m_pCell+nColCount*aChange.LastRow );
-                    m_pImpl->m_pTable->getAccessibleCellVector().erase(m_xAccessibleVector+nColCount*aChange.FirstRow, m_xAccessibleVector+nColCount*aChange.LastRow);
+                    // check valid index - entries are inserted lazily
+                    size_t const nStart = nColCount * aChange.FirstRow;
+                    size_t const nEnd   = nColCount * aChange.LastRow;
+                    if (nStart < rCells.size())
+                    {
+                        m_pImpl->m_pTable->getCellVector().erase(
+                            rCells.begin() + nStart,
+                            rCells.begin() + std::min(rCells.size(), nEnd));
+                    }
+                    if (nStart < rAccCells.size())
+                    {
+                        m_pImpl->m_pTable->getAccessibleCellVector().erase(
+                            rAccCells.begin() + nStart,
+                            rAccCells.begin() + std::min(rAccCells.size(), nEnd));
+                    }
                     m_pImpl->m_pTable->commitEvent(_nEventId,_rNewValue,_rOldValue);
                 }
                 else
commit da21e9de6a71dcd1926f5bf167049bce0590515e
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Oct 3 14:57:12 2013 +0200

    require OAccessibleContextHelper to be initialized with SolarMutex
    
    OAccessibleContextHelper methods are locked by OExternalLockGuard
    which effectively only locks its ExternalMutex (i.e. SolarMutex);
    so ensure that all sub-classes actually pass in a SolarMutex
    by removing the default constructor.
    
    (since these classes are in comphelper they can only use the
    SolarMutex indirectly)
    
    This uncovers that AccessibleToolPanelDeckTabBarItem and
    OAccessibleControlContext did not pass in SolarMutex before.
    
    Change-Id: Ib9085eeee6225f7c74b158e72f04b1bf62622071

diff --git a/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx b/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx
index 86c8680..8b7a2fd 100644
--- a/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx
+++ b/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx
@@ -29,6 +29,7 @@
 #include <svtools/toolpanel/paneltabbar.hxx>
 #include <unotools/accessiblestatesethelper.hxx>
 #include <unotools/accessiblerelationsethelper.hxx>
+#include <toolkit/helper/externallock.hxx>
 #include <tools/diagnose_ex.h>
 #include <vcl/svapp.hxx>
 #include <osl/mutex.hxx>
@@ -263,7 +264,10 @@ namespace accessibility
     //------------------------------------------------------------------------------------------------------------------
     AccessibleToolPanelDeckTabBarItem::AccessibleToolPanelDeckTabBarItem( const Reference< XAccessible >& i_rAccessibleParent,
             ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar, const size_t i_nItemPos )
-        :m_pImpl( new AccessibleToolPanelDeckTabBarItem_Impl( *this, i_rAccessibleParent, i_rPanelDeck, i_rTabBar, i_nItemPos ) )
+        : ::comphelper::OAccessibleExtendedComponentHelper(
+                new VCLExternalSolarLock)
+        , m_pImpl(new AccessibleToolPanelDeckTabBarItem_Impl(*this,
+                i_rAccessibleParent, i_rPanelDeck, i_rTabBar, i_nItemPos))
     {
     }
 
diff --git a/comphelper/source/misc/accessiblecomponenthelper.cxx b/comphelper/source/misc/accessiblecomponenthelper.cxx
index 0a7c08c..816b24b 100644
--- a/comphelper/source/misc/accessiblecomponenthelper.cxx
+++ b/comphelper/source/misc/accessiblecomponenthelper.cxx
@@ -33,11 +33,6 @@ namespace comphelper
     //= OCommonAccessibleComponent
     //=====================================================================
     //---------------------------------------------------------------------
-    OCommonAccessibleComponent::OCommonAccessibleComponent( )
-    {
-    }
-
-    //---------------------------------------------------------------------
     OCommonAccessibleComponent::OCommonAccessibleComponent( IMutex* _pExternalLock )
         :OAccessibleContextHelper( _pExternalLock )
     {
@@ -46,9 +41,6 @@ namespace comphelper
     //---------------------------------------------------------------------
     OCommonAccessibleComponent::~OCommonAccessibleComponent( )
     {
-        forgetExternalLock();
-            // this ensures that the lock, which may be already destroyed as part of the derivee,
-            // is not used anymore
     }
 
     //--------------------------------------------------------------------
@@ -109,11 +101,6 @@ namespace comphelper
     //= OAccessibleComponentHelper
     //=====================================================================
     //---------------------------------------------------------------------
-    OAccessibleComponentHelper::OAccessibleComponentHelper( )
-    {
-    }
-
-    //---------------------------------------------------------------------
     OAccessibleComponentHelper::OAccessibleComponentHelper( IMutex* _pExternalLock )
         :OCommonAccessibleComponent( _pExternalLock )
     {
@@ -158,11 +145,6 @@ namespace comphelper
     //= OAccessibleExtendedComponentHelper
     //=====================================================================
     //---------------------------------------------------------------------
-    OAccessibleExtendedComponentHelper::OAccessibleExtendedComponentHelper( )
-    {
-    }
-
-    //---------------------------------------------------------------------
     OAccessibleExtendedComponentHelper::OAccessibleExtendedComponentHelper( IMutex* _pExternalLock )
         :OCommonAccessibleComponent( _pExternalLock )
     {
diff --git a/comphelper/source/misc/accessiblecontexthelper.cxx b/comphelper/source/misc/accessiblecontexthelper.cxx
index bb9047d..3b78363 100644
--- a/comphelper/source/misc/accessiblecontexthelper.cxx
+++ b/comphelper/source/misc/accessiblecontexthelper.cxx
@@ -79,18 +79,11 @@ namespace comphelper
     //= OAccessibleContextHelper
     //=====================================================================
     //---------------------------------------------------------------------
-    OAccessibleContextHelper::OAccessibleContextHelper( )
-        :OAccessibleContextHelper_Base( GetMutex() )
-        ,m_pImpl( NULL )
-    {
-        m_pImpl = new OContextHelper_Impl();
-    }
-
-    //---------------------------------------------------------------------
     OAccessibleContextHelper::OAccessibleContextHelper( IMutex* _pExternalLock )
         :OAccessibleContextHelper_Base( GetMutex() )
         ,m_pImpl( NULL )
     {
+        assert(_pExternalLock);
         m_pImpl = new OContextHelper_Impl();
         m_pImpl->setExternalLock( _pExternalLock );
     }
diff --git a/include/comphelper/accessiblecomponenthelper.hxx b/include/comphelper/accessiblecomponenthelper.hxx
index d0eabc2..dc31550 100644
--- a/include/comphelper/accessiblecomponenthelper.hxx
+++ b/include/comphelper/accessiblecomponenthelper.hxx
@@ -41,7 +41,6 @@ namespace comphelper
     class COMPHELPER_DLLPUBLIC OCommonAccessibleComponent : public OAccessibleContextHelper
     {
     protected:
-        OCommonAccessibleComponent();
         /// see the respective base class ctor for an extensive comment on this, please
         OCommonAccessibleComponent( IMutex* _pExternalLock );
         ~OCommonAccessibleComponent();
@@ -81,7 +80,6 @@ namespace comphelper
             ,public OAccessibleComponentHelper_Base
     {
     protected:
-        OAccessibleComponentHelper( );
         /// see the respective base class ctor for an extensive comment on this, please
         OAccessibleComponentHelper( IMutex* _pExternalLock );
 
@@ -113,7 +111,6 @@ namespace comphelper
             ,public OAccessibleExtendedComponentHelper_Base
     {
     protected:
-        OAccessibleExtendedComponentHelper( );
         /// see the respective base class ctor for an extensive comment on this, please
         OAccessibleExtendedComponentHelper( IMutex* _pExternalLock );
 
diff --git a/include/comphelper/accessiblecontexthelper.hxx b/include/comphelper/accessiblecontexthelper.hxx
index e6c5c10..f01c911 100644
--- a/include/comphelper/accessiblecontexthelper.hxx
+++ b/include/comphelper/accessiblecontexthelper.hxx
@@ -90,7 +90,6 @@ namespace comphelper
         OContextHelper_Impl*    m_pImpl;
 
     protected:
-        OAccessibleContextHelper( );
         ~OAccessibleContextHelper( );
 
         /** ctor
@@ -141,6 +140,7 @@ namespace comphelper
         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
                 getAccessibleCreator( ) const;
 
+    private:
         /** forgets the reference to the external lock, if present.
 
             <p>This means any further locking will not be guard the external lock anymore, never.</p>
diff --git a/toolkit/source/controls/accessiblecontrolcontext.cxx b/toolkit/source/controls/accessiblecontrolcontext.cxx
index 7be5732..509d2ba 100644
--- a/toolkit/source/controls/accessiblecontrolcontext.cxx
+++ b/toolkit/source/controls/accessiblecontrolcontext.cxx
@@ -25,6 +25,7 @@
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 #include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/externallock.hxx>
 #include <vcl/window.hxx>
 
 //........................................................................
@@ -44,7 +45,7 @@ namespace toolkit
     //====================================================================
     //--------------------------------------------------------------------
     OAccessibleControlContext::OAccessibleControlContext()
-        :OAccessibleControlContext_Base( )
+        : OAccessibleControlContext_Base(new VCLExternalSolarLock)
     {
         // nothing to do here, we have a late ctor
     }


More information about the Libreoffice-commits mailing list