sw/source/core/access/accdoc.cxx | 12 ++++++++-- sw/source/core/access/acctable.cxx | 44 ++++++++++++++++++++++--------------- sw/source/core/access/acctable.hxx | 9 ++++--- sw/source/core/layout/tabfrm.cxx | 22 ------------------ 4 files changed, 42 insertions(+), 45 deletions(-)
New commits: commit cbfee5d07d6f6be9d8c7c341e8d4c139762277aa Author: Tor Lillqvist <t...@collabora.com> Date: Tue Jun 3 15:54:39 2014 +0300 Fix compilation error after conflict mis-resolution Change-Id: I33510133dc984e9a7ddc6f2c42749d35c7cbe2b7 diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx index 4df1166..c004e67 100644 --- a/sw/source/core/access/acctable.cxx +++ b/sw/source/core/access/acctable.cxx @@ -1792,7 +1792,8 @@ void SwAccessibleTable::ClearSelectionCellCache() m_vecCellRemove.clear(); } -void SwAccessibleTable::AddSelectionCell(const SwAccessibleContext* pAccCell ,sal_Bool bAddOrRemove) +void SwAccessibleTable::AddSelectionCell( + SwAccessibleContext *const pAccCell, sal_Bool bAddOrRemove) { uno::Reference<XAccessible> const xTmp(pAccCell); if (bAddOrRemove) diff --git a/sw/source/core/access/acctable.hxx b/sw/source/core/access/acctable.hxx index 2a239ea..9842acc 100644 --- a/sw/source/core/access/acctable.hxx +++ b/sw/source/core/access/acctable.hxx @@ -269,7 +269,7 @@ public: Cells_t m_vecCellRemove; void FireSelectionEvent( ); void ClearSelectionCellCache(); - void AddSelectionCell(const SwAccessibleContext* ,sal_Bool bAddOrRemove); + void AddSelectionCell(SwAccessibleContext* ,sal_Bool bAddOrRemove); }; inline SwAccessibleTableData_Impl& SwAccessibleTable::GetTableData() commit 0e3847bcae0a80c74a61ee10594ed2b48edd507d Author: Michael Stahl <mst...@redhat.com> Date: Fri Dec 13 22:10:17 2013 +0100 sw: SwAccessibleDocument: fix crashes Add missing SolarMutexGuards and also GetMap() may be 0 if it's disposed. (regression from 76c549eb01dcb7b5bf28a271ce00e386f3d388ba) Change-Id: I65312098e3d4cc6f686c3fc9e05dc8a6c4da34ce diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx index f530184..2d62e80 100644 --- a/sw/source/core/access/accdoc.cxx +++ b/sw/source/core/access/accdoc.cxx @@ -205,8 +205,10 @@ OUString SAL_CALL SwAccessibleDocumentBase::getAccessibleDescription (void) OUString SAL_CALL SwAccessibleDocumentBase::getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException) { + SolarMutexGuard g; + OUString sAccName = GetResource( STR_ACCESS_DOC_WORDPROCESSING ); - SwDoc *pDoc = GetShell()->GetDoc(); + SwDoc *pDoc = GetMap() ? GetShell()->GetDoc() : 0; if ( pDoc ) { OUString sFileName = pDoc->getDocAccTitle(); @@ -574,6 +576,8 @@ void SwAccessibleDocument::deselectAccessibleChild( void SAL_CALL SwAccessibleDocument::notifyEvent( const ::com::sun::star::document::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException) { + SolarMutexGuard g; + if ( Event.EventName.equalsAscii( "FirstPageShows" ) ) { FireStateChangedEvent( AccessibleStateType::FOCUSED,sal_True ); @@ -605,8 +609,10 @@ void SAL_CALL SwAccessibleDocument::disposing( const ::com::sun::star::lang::Eve uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes() throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) { + SolarMutexGuard g; + uno::Any anyAtrribute; - SwDoc *pDoc = GetShell()->GetDoc(); + SwDoc *pDoc = GetMap() ? GetShell()->GetDoc() : 0; if (!pDoc) return anyAtrribute; @@ -854,6 +860,8 @@ sal_Int32 SAL_CALL SwAccessibleDocument::getBackground() SAL_CALL SwAccessibleDocument::get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType) throw ( ::com::sun::star::uno::RuntimeException ) { + SolarMutexGuard g; + const sal_Int32 FORSPELLCHECKFLOWTO = 1; const sal_Int32 FORFINDREPLACEFLOWTO = 2; SwAccessibleMap* pAccMap = GetMap(); commit 5aa4e58d8ec9ccfa2a7eb2aab2fceeefbe3ac94d Author: Michael Stahl <mst...@redhat.com> Date: Mon May 5 15:23:35 2014 +0200 fdo#57197: sw: check that cells are still alive ... ... before firing events from them; use a thread-safe WeakReference. (regression from 76c549eb01dcb7b5bf28a271ce00e386f3d388ba) Conflicts: sw/source/core/access/acctable.cxx sw/source/core/access/acctable.hxx Change-Id: Ie060d27cc44415e9a75b75027f5510577ac17a6e diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx index 18c5ad3..4df1166 100644 --- a/sw/source/core/access/acctable.cxx +++ b/sw/source/core/access/acctable.cxx @@ -1749,26 +1749,33 @@ void SwAccessibleTable::FireSelectionEvent( ) aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE; -// int nRemove = m_vecCellRemove.size(); -// int nAdd = m_vecCellAdd.size(); - - VEC_CELL::iterator vi = m_vecCellRemove.begin(); - for (; vi != m_vecCellRemove.end() ; ++vi) + for (Cells_t::iterator vi = m_vecCellRemove.begin(); + vi != m_vecCellRemove.end(); ++vi) { - SwAccessibleContext *pAccCell = const_cast<SwAccessibleContext *>(*vi); - OSL_ASSERT(pAccCell != NULL ); - pAccCell->FireAccessibleEvent(aEvent); + // fdo#57197: check if the object is still alive + uno::Reference<XAccessible> const xAcc(vi->second); + if (xAcc.is()) + { + SwAccessibleContext *const pAccCell(vi->first); + assert(pAccCell); + pAccCell->FireAccessibleEvent(aEvent); + } } if (m_vecCellAdd.size() <= SELECTION_WITH_NUM) { aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD; - vi = m_vecCellAdd.begin(); - for (; vi != m_vecCellAdd.end() ; ++vi) + for (Cells_t::iterator vi = m_vecCellAdd.begin(); + vi != m_vecCellAdd.end(); ++vi) { - SwAccessibleContext *pAccCell = const_cast<SwAccessibleContext *>(*vi); - OSL_ASSERT(pAccCell != NULL ); - pAccCell->FireAccessibleEvent(aEvent); + // fdo#57197: check if the object is still alive + uno::Reference<XAccessible> const xAcc(vi->second); + if (xAcc.is()) + { + SwAccessibleContext *const pAccCell(vi->first); + assert(pAccCell); + pAccCell->FireAccessibleEvent(aEvent); + } } return ; } @@ -1787,13 +1794,14 @@ void SwAccessibleTable::ClearSelectionCellCache() void SwAccessibleTable::AddSelectionCell(const SwAccessibleContext* pAccCell ,sal_Bool bAddOrRemove) { + uno::Reference<XAccessible> const xTmp(pAccCell); if (bAddOrRemove) { - m_vecCellAdd.push_back(pAccCell); + m_vecCellAdd.push_back(std::make_pair(pAccCell, xTmp)); } else { - m_vecCellRemove.push_back(pAccCell); + m_vecCellRemove.push_back(std::make_pair(pAccCell, xTmp)); } } diff --git a/sw/source/core/access/acctable.hxx b/sw/source/core/access/acctable.hxx index 6ee40f7..2a239ea 100644 --- a/sw/source/core/access/acctable.hxx +++ b/sw/source/core/access/acctable.hxx @@ -263,9 +263,10 @@ public: //===== XAccessibleComponent ============================================ sal_Int32 SAL_CALL getBackground() throw (::com::sun::star::uno::RuntimeException); - typedef std::vector<const SwAccessibleContext*> VEC_CELL; - VEC_CELL m_vecCellAdd; - VEC_CELL m_vecCellRemove; + typedef std::vector< ::std::pair<SwAccessibleContext*, + css::uno::WeakReference<css::accessibility::XAccessible> > > Cells_t; + Cells_t m_vecCellAdd; + Cells_t m_vecCellRemove; void FireSelectionEvent( ); void ClearSelectionCellCache(); void AddSelectionCell(const SwAccessibleContext* ,sal_Bool bAddOrRemove); commit 7e16e737d05ed63a514af971670d5ab5b4b37df0 Author: Michael Stahl <mst...@redhat.com> Date: Mon May 5 21:45:55 2014 +0200 sw: don't dispose SwAccessibles in SwRowFrm::Cut() This does not appear to work so well: for a row with multiple cells, when the second cell frame's SwAccessible is disposed it will send an event, and the AtkListener will then request all children of the row, and this causes a new SwAccessible to be created for the first cell frame that was disposed previously. Unlike most other events, Dispose events cannot be sent delayed. The SwAccessibles are disposed from ~SwCellFrm already, that should be sufficient. Change-Id: I6da72605e5386540f8d82535fca151e97d70869f diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx index bb32130..18c5ad3 100644 --- a/sw/source/core/access/acctable.cxx +++ b/sw/source/core/access/acctable.cxx @@ -1459,7 +1459,8 @@ void SwAccessibleTable::InvalidateChildPosOrSize( const SwAccessibleChild& rChil SwAccessibleTableData_Impl *pNewTableData = CreateNewTableData(); // #i77106# if( !pNewTableData->CompareExtents( GetTableData() ) ) { - if(pNewTableData->GetRowCount()!= mpTableData->GetRowCount()) + if (pNewTableData->GetRowCount() != mpTableData->GetRowCount() + && 1 < GetTableData().GetRowCount()) { Int32Set_Impl::const_iterator aSttCol( GetTableData().GetColumnIter( 0 ) ); Int32Set_Impl::const_iterator aSttRow( GetTableData().GetRowIter( 1 ) ); diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 5f8a584..3bf8903 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -4415,28 +4415,6 @@ void SwRowFrm::Cut() pTab->FindMaster()->InvalidatePos(); } - // #i103961# - // notification for accessibility - { - SwRootFrm *pRootFrm = getRootFrm(); - if( pRootFrm && pRootFrm->IsAnyShellAccessible() ) - { - SwViewShell* pVSh = pRootFrm->GetCurrShell(); - if ( pVSh && pVSh->Imp() ) - { - SwFrm* pCellFrm( GetLower() ); - while ( pCellFrm ) - { - OSL_ENSURE( pCellFrm->IsCellFrm(), - "<SwRowFrm::Cut()> - unexpected type of SwRowFrm lower." ); - pVSh->Imp()->DisposeAccessibleFrm( pCellFrm ); - - pCellFrm = pCellFrm->GetNext(); - } - } - } - } - SwLayoutFrm::Cut(); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits