extensions/source/propctrlr/browserlistbox.cxx | 9 - external/hunspell/0002-fix-other-regression-in-compounding.patch | 43 ++++++ external/hunspell/0005-fix-syllable-counting-in-compound-word-handling.patch | 66 ++++++++++ external/hunspell/UnpackedTarball_hunspell.mk | 2 fpicker/source/win32/filepicker/VistaFilePicker.cxx | 19 ++ fpicker/source/win32/filepicker/VistaFilePicker.hxx | 2 lotuswordpro/source/filter/lwpframelayout.cxx | 7 - lotuswordpro/source/filter/lwpframelayout.hxx | 1 sw/inc/accmap.hxx | 5 sw/source/core/access/acccell.cxx | 2 sw/source/core/access/acccell.hxx | 3 sw/source/core/access/acccontext.cxx | 42 +++++- sw/source/core/access/acccontext.hxx | 12 + sw/source/core/access/accdoc.cxx | 18 +- sw/source/core/access/accdoc.hxx | 4 sw/source/core/access/accembedded.cxx | 2 sw/source/core/access/accembedded.hxx | 2 sw/source/core/access/accfootnote.cxx | 2 sw/source/core/access/accfootnote.hxx | 2 sw/source/core/access/accframebase.cxx | 2 sw/source/core/access/accframebase.hxx | 2 sw/source/core/access/accgraphic.cxx | 2 sw/source/core/access/accgraphic.hxx | 2 sw/source/core/access/accheaderfooter.cxx | 4 sw/source/core/access/accheaderfooter.hxx | 4 sw/source/core/access/accmap.cxx | 39 +++-- sw/source/core/access/accnotextframe.cxx | 2 sw/source/core/access/accnotextframe.hxx | 2 sw/source/core/access/accpage.cxx | 2 sw/source/core/access/accpage.hxx | 3 sw/source/core/access/accpara.cxx | 2 sw/source/core/access/accpara.hxx | 2 sw/source/core/access/accpreview.cxx | 4 sw/source/core/access/accpreview.hxx | 2 sw/source/core/access/acctable.cxx | 12 + sw/source/core/access/acctable.hxx | 6 sw/source/core/access/acctextframe.cxx | 2 sw/source/core/access/acctextframe.hxx | 3 sw/source/core/inc/viewimp.hxx | 4 sw/source/core/view/viewimp.cxx | 8 - wizards/source/access2base/Application.xba | 2 wizards/source/depot/Currency.xba | 4 wizards/source/depot/Internet.xba | 4 wizards/source/formwizard/DBMeta.xba | 6 wizards/source/formwizard/FormWizard.xba | 6 wizards/source/formwizard/Language.xba | 14 +- writerfilter/source/dmapper/DomainMapper_Impl.cxx | 16 +- 47 files changed, 297 insertions(+), 107 deletions(-)
New commits: commit 47144435ecb3801b4a1e50e75047bfdc8aaa9946 Author: Michael Stahl <[email protected]> Date: Fri Mar 24 13:04:32 2017 +0100 tdf#58624 sw: fix ~SwAccessibleContext() use-after-free race As seen in JunitTest_toolkit_unoapi_1: Method doAccessibleAction() finished with state OK LOG> doAccessibleAction(): COMPLETED.OK debug:27272:12: -SwAccessibleParagraph mutexwait 0x3fd9f50 debug:27272:9: SwAccessibleContext::Dispose 0x3872620 11SwRootFrame debug:27272:9: SwAccessibleContext::DisposeChildren 0x4047c80 0x386d600 11SwPageFrame debug:27272:9: SwAccessibleContext::DisposeChildren xAcc 0 debug:27272:9: SwAccessibleContext::DisposeChildren 0x4047c80 0x386cef0 11SwBodyFrame debug:27272:9: SwAccessibleContext::DisposeChildren xAcc 0 debug:27272:9: SwAccessibleContext::DisposeChildren 0x4047c80 0x3878fe0 11SwTextFrame debug:27272:9: SwAccessibleContext::DisposeChildren xAcc 0 debug:27272:9: SwAccessibleMap::RemoveContext erase 0x3872620 debug:27272:9: ~SwAccessibleMap: frame entry 0x3878fe0 debug:27272:9: ~SwAccessibleMap: mpFrameMap 0x3eb64a0 debug:27272:9: ~SwAccessibleMap: mpShapeMap 0 soffice.bin: sw/source/core/access/accmap.cxx:1726: virtual SwAccessibleMap::~SwAccessibleMap(): Assertion `(!mpFrameMap || mpFrameMap->empty()) && "Frame map should be empty after disposing the root frame"' The problem here is that thread 12 is blocked on SolarMutex in ~SwAccessibleParagraph(), while thread 9 is in ~SwAccessibleMap(). This means that in SwAccessibleContext::DisposeChildren(), the WeakReference to the SwAccessibleParagraph cannot create a uno::Reference because its reference count is 0, so SwAccessibleContext::Dispose() is not called on it and it remains in the SwAccessibleMap::mpFrameMap. This triggers the assert and later on ~SwAccessibleContext() would access the deleted SwAccessibleMap and crash. To fix this, introduce a weak reference from SwAccessibleContext to SwAccessibleMap; use a std::weak_ptr because that is not derived from OWeakObject. The weak_ptr is only used in the dtor ~SwAccessibleContext(); as long as the ref-count of SwAccessibleContext is > 0 it is guaranteed that the SwAccessibleContext::m_pMap is either null or valid as the recursive Dispose() will work fine. It is possible that additional temporary owning references could delay the destruction of SwAccessibleMap, and the order of destruction of Writer documents is very fragile, so rely on the SolarMutex lock to prevent that; the only shared_ptr that owns SwAccessibleMap while SolarMutex is not locked is the one in SwViewShellImp. (An alternative fix would be to represent the 3 lifecycle stages of SwAccessibleContext by adding a C++-pointer to the SwAccessibleMap::mpFrameMap, so that DisposeChildren() can, if the WeakReference is no longer valid due to ref-count 0, use the pointer and clear SwAccessibleContext::m_pMap - this and the corresponding call to SwAccessibleMap::RemoveContext() from ~SwAccessibleContext() under a mutex that is shared_ptr-owned by SwAccessibleMap and all SwAccessibleContext.) Change-Id: If2b44c79189e3b3d276491a5c57d5404bb2be71a (cherry picked from commit 0c2229dcab143925c6ad390e0735e2d98c3eecca) Reviewed-on: https://gerrit.libreoffice.org/35654 Tested-by: Jenkins <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> (cherry picked from commit aba392d1a07b8b0d40583d7e893a409cf96f1725) diff --git a/sw/inc/accmap.hxx b/sw/inc/accmap.hxx index aaef5a76b08f..c1ff5256e38c 100644 --- a/sw/inc/accmap.hxx +++ b/sw/inc/accmap.hxx @@ -30,10 +30,12 @@ #include <svx/AccessibleControlShape.hxx> #include <svx/AccessibleShape.hxx> #include "fesh.hxx" +#include <o3tl/typed_flags_set.hxx> + #include <list> #include <vector> +#include <memory> #include <set> -#include <o3tl/typed_flags_set.hxx> class SwAccessibleParagraph; class SwViewShell; @@ -88,6 +90,7 @@ namespace o3tl class SwAccessibleMap : public ::accessibility::IAccessibleViewForwarder, public ::accessibility::IAccessibleParent + , public std::enable_shared_from_this<SwAccessibleMap> { mutable ::osl::Mutex maMutex; ::osl::Mutex maEventMutex; diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx index 694a56069486..b153bfe73215 100644 --- a/sw/source/core/access/acccell.cxx +++ b/sw/source/core/access/acccell.cxx @@ -98,7 +98,7 @@ void SwAccessibleCell::GetStates( ::utl::AccessibleStateSetHelper& rStateSet ) } } -SwAccessibleCell::SwAccessibleCell( SwAccessibleMap *pInitMap, +SwAccessibleCell::SwAccessibleCell(std::shared_ptr<SwAccessibleMap> const& pInitMap, const SwCellFrame *pCellFrame ) : SwAccessibleContext( pInitMap, AccessibleRole::TABLE_CELL, pCellFrame ) , aSelectionHelper( *this ) diff --git a/sw/source/core/access/acccell.hxx b/sw/source/core/access/acccell.hxx index ab95afdeb1c6..54554f9f0ac0 100644 --- a/sw/source/core/access/acccell.hxx +++ b/sw/source/core/access/acccell.hxx @@ -54,7 +54,8 @@ protected: virtual ~SwAccessibleCell() override; public: - SwAccessibleCell( SwAccessibleMap* pInitMap, const SwCellFrame *pCellFrame ); + SwAccessibleCell(std::shared_ptr<SwAccessibleMap> const& pInitMap, + const SwCellFrame *pCellFrame); virtual bool HasCursor() override; // required by map to remember that object diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx index e0069991f214..dce1c0e03f10 100644 --- a/sw/source/core/access/acccontext.cxx +++ b/sw/source/core/access/acccontext.cxx @@ -406,8 +406,21 @@ void SwAccessibleContext::DisposeChildren(const SwFrame *pFrame, xAccImpl = GetMap()->GetContextImpl( pLower, false ); if( xAccImpl.is() ) xAccImpl->Dispose( bRecursive ); - else if( bRecursive ) - DisposeChildren(pLower, bRecursive, bCanSkipInvisible); + else + { + // it's possible that the xAccImpl *does* exist with a + // ref-count of 0 and blocked in its dtor in another thread - + // this call here could be from SwAccessibleMap dtor so + // remove it from any maps now! + GetMap()->RemoveContext(pLower); + // in this case the context will check with a weak_ptr + // that the map is still alive so it's not necessary + // to clear its m_pMap here. + if (bRecursive) + { + DisposeChildren(pLower, bRecursive, bCanSkipInvisible); + } + } } else if ( rLower.GetDrawObject() ) { @@ -517,12 +530,13 @@ bool SwAccessibleContext::IsEditableState() return bRet; } -SwAccessibleContext::SwAccessibleContext( SwAccessibleMap *const pMap, +SwAccessibleContext::SwAccessibleContext(std::shared_ptr<SwAccessibleMap> const& pMap, sal_Int16 const nRole, const SwFrame *pF ) : SwAccessibleFrame( pMap->GetVisArea().SVRect(), pF, pMap->GetShell()->IsPreview() ) - , m_pMap( pMap ) + , m_pMap(pMap.get()) + , m_wMap(pMap) , m_nClientId(0) , m_nRole(nRole) , m_isDisposing( false ) @@ -534,8 +548,16 @@ SwAccessibleContext::SwAccessibleContext( SwAccessibleMap *const pMap, SwAccessibleContext::~SwAccessibleContext() { + // must have for 2 reasons: 2. as long as this thread has SolarMutex + // another thread cannot destroy the SwAccessibleMap so our temporary + // taking a hard ref to SwAccessibleMap won't delay its destruction SolarMutexGuard aGuard; - RemoveFrameFromAccessibleMap(); + // must check with weak_ptr that m_pMap is still alive + std::shared_ptr<SwAccessibleMap> pMap(m_wMap.lock()); + if (m_isRegisteredAtAccessibleMap && GetFrame() && pMap) + { + pMap->RemoveContext( GetFrame() ); + } } uno::Reference< XAccessibleContext > SAL_CALL @@ -1075,6 +1097,7 @@ void SwAccessibleContext::Dispose(bool bRecursive, bool bCanSkipInvisible) RemoveFrameFromAccessibleMap(); ClearFrame(); m_pMap = nullptr; + m_wMap.reset(); m_isDisposing = false; } @@ -1432,8 +1455,17 @@ OUString SwAccessibleContext::GetResource( sal_uInt16 nResId, return sStr; } + +void SwAccessibleContext::ClearMapPointer() +{ + DBG_TESTSOLARMUTEX(); + m_pMap = nullptr; + m_wMap.reset(); +} + void SwAccessibleContext::RemoveFrameFromAccessibleMap() { + assert(m_refCount > 0); // must be alive to do this without using m_wMap if (m_isRegisteredAtAccessibleMap && GetFrame() && GetMap()) GetMap()->RemoveContext( GetFrame() ); } diff --git a/sw/source/core/access/acccontext.hxx b/sw/source/core/access/acccontext.hxx index 31ed088111e4..4dc504f9a057 100644 --- a/sw/source/core/access/acccontext.hxx +++ b/sw/source/core/access/acccontext.hxx @@ -29,6 +29,8 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/interfacecontainer.hxx> +#include <memory> + namespace vcl { class Window; } class SwAccessibleMap; class SwCursorShell; @@ -70,6 +72,10 @@ private: css::accessibility::XAccessible > m_xWeakParent; SwAccessibleMap *m_pMap; // must be protected by solar mutex + /// note: the m_pMap is guaranteed to be valid until we hit the + /// dtor ~SwAccessibleContext, then m_wMap must be checked if it's still + /// alive, after locking SolarMutex (alternatively, Dispose clears m_pMap) + std::weak_ptr<SwAccessibleMap> m_wMap; sal_uInt32 m_nClientId; // client id in the AccessibleEventNotifier queue sal_Int16 m_nRole; // immutable outside constructor @@ -161,7 +167,7 @@ protected: virtual void InvalidateFocus_(); public: - void SetMap(SwAccessibleMap *const pMap) { m_pMap = pMap; } + void ClearMapPointer(); void FireAccessibleEvent( css::accessibility::AccessibleEventObject& rEvent ); protected: @@ -192,8 +198,8 @@ protected: virtual ~SwAccessibleContext() override; public: - SwAccessibleContext( SwAccessibleMap *m_pMap, sal_Int16 nRole, - const SwFrame *pFrame ); + SwAccessibleContext( std::shared_ptr<SwAccessibleMap> const& pMap, + sal_Int16 nRole, const SwFrame *pFrame ); // XAccessible diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx index 06b9c5b7f0e2..0df510cbd79c 100644 --- a/sw/source/core/access/accdoc.cxx +++ b/sw/source/core/access/accdoc.cxx @@ -70,11 +70,12 @@ using lang::IndexOutOfBoundsException; // SwAccessibleDocumentBase: base class for SwAccessibleDocument and // SwAccessiblePreview -SwAccessibleDocumentBase::SwAccessibleDocumentBase ( SwAccessibleMap *_pMap ) : - SwAccessibleContext( _pMap, AccessibleRole::DOCUMENT_TEXT, - _pMap->GetShell()->GetLayout() ), - mxParent( _pMap->GetShell()->GetWin()->GetAccessibleParentWindow()->GetAccessible() ), - mpChildWin( nullptr ) +SwAccessibleDocumentBase::SwAccessibleDocumentBase( + std::shared_ptr<SwAccessibleMap> const& pMap) + : SwAccessibleContext(pMap, AccessibleRole::DOCUMENT_TEXT, + pMap->GetShell()->GetLayout()) + , mxParent(pMap->GetShell()->GetWin()->GetAccessibleParentWindow()->GetAccessible()) + , mpChildWin(nullptr) { } @@ -348,9 +349,10 @@ void SwAccessibleDocument::GetStates( rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); } -SwAccessibleDocument::SwAccessibleDocument ( SwAccessibleMap* pInitMap ) : - SwAccessibleDocumentBase( pInitMap ), - maSelectionHelper( *this ) +SwAccessibleDocument::SwAccessibleDocument( + std::shared_ptr<SwAccessibleMap> const& pInitMap) + : SwAccessibleDocumentBase(pInitMap) + , maSelectionHelper(*this) { SetName( GetResource( STR_ACCESS_DOC_NAME ) ); vcl::Window *pWin = pInitMap->GetShell()->GetWin(); diff --git a/sw/source/core/access/accdoc.hxx b/sw/source/core/access/accdoc.hxx index 47caf4cac4b0..6e927bd3740e 100644 --- a/sw/source/core/access/accdoc.hxx +++ b/sw/source/core/access/accdoc.hxx @@ -43,7 +43,7 @@ protected: virtual ~SwAccessibleDocumentBase() override; public: - SwAccessibleDocumentBase( SwAccessibleMap* pInitMap ); + SwAccessibleDocumentBase(std::shared_ptr<SwAccessibleMap> const& pInitMap); void SetVisArea(); @@ -120,7 +120,7 @@ protected: virtual ~SwAccessibleDocument() override; public: - SwAccessibleDocument( SwAccessibleMap* pInitMap ); + SwAccessibleDocument(std::shared_ptr<SwAccessibleMap> const& pInitMap); DECL_LINK( WindowChildEventListener, VclWindowEvent&, void ); diff --git a/sw/source/core/access/accembedded.cxx b/sw/source/core/access/accembedded.cxx index ef3b70b992d2..ebff72a5bae9 100644 --- a/sw/source/core/access/accembedded.cxx +++ b/sw/source/core/access/accembedded.cxx @@ -36,7 +36,7 @@ using namespace ::com::sun::star::accessibility; const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleEmbeddedObject"; SwAccessibleEmbeddedObject::SwAccessibleEmbeddedObject( - SwAccessibleMap* pInitMap, + std::shared_ptr<SwAccessibleMap> const& pInitMap, const SwFlyFrame* pFlyFrame ) : SwAccessibleNoTextFrame( pInitMap, AccessibleRole::EMBEDDED_OBJECT, pFlyFrame ) { diff --git a/sw/source/core/access/accembedded.hxx b/sw/source/core/access/accembedded.hxx index 76792b649c5c..5b27308bc69b 100644 --- a/sw/source/core/access/accembedded.hxx +++ b/sw/source/core/access/accembedded.hxx @@ -32,7 +32,7 @@ protected: virtual ~SwAccessibleEmbeddedObject() override; public: - SwAccessibleEmbeddedObject( SwAccessibleMap* pInitMap, + SwAccessibleEmbeddedObject(std::shared_ptr<SwAccessibleMap> const& pInitMap, const SwFlyFrame* pFlyFrame ); // XInterface diff --git a/sw/source/core/access/accfootnote.cxx b/sw/source/core/access/accfootnote.cxx index 7c16caba2316..cfcf958e0f0a 100644 --- a/sw/source/core/access/accfootnote.cxx +++ b/sw/source/core/access/accfootnote.cxx @@ -41,7 +41,7 @@ const sal_Char sImplementationNameFootnote[] = "com.sun.star.comp.Writer.SwAcces const sal_Char sImplementationNameEndnote[] = "com.sun.star.comp.Writer.SwAccessibleEndnoteView"; SwAccessibleFootnote::SwAccessibleFootnote( - SwAccessibleMap* pInitMap, + std::shared_ptr<SwAccessibleMap> const& pInitMap, bool bIsEndnote, const SwFootnoteFrame *pFootnoteFrame ) : SwAccessibleContext( pInitMap, diff --git a/sw/source/core/access/accfootnote.hxx b/sw/source/core/access/accfootnote.hxx index 12ff3e70e8de..a326dd2c0659 100644 --- a/sw/source/core/access/accfootnote.hxx +++ b/sw/source/core/access/accfootnote.hxx @@ -32,7 +32,7 @@ protected: virtual ~SwAccessibleFootnote() override; public: - SwAccessibleFootnote( SwAccessibleMap* pInitMap, + SwAccessibleFootnote( std::shared_ptr<SwAccessibleMap> const& pInitMap, bool bIsEndnote, const SwFootnoteFrame *pFootnoteFrame ); diff --git a/sw/source/core/access/accframebase.cxx b/sw/source/core/access/accframebase.cxx index 13823155ca18..f641ff8f2506 100644 --- a/sw/source/core/access/accframebase.cxx +++ b/sw/source/core/access/accframebase.cxx @@ -124,7 +124,7 @@ sal_uInt8 SwAccessibleFrameBase::GetNodeType( const SwFlyFrame *pFlyFrame ) } SwAccessibleFrameBase::SwAccessibleFrameBase( - SwAccessibleMap* pInitMap, + std::shared_ptr<SwAccessibleMap> const& pInitMap, sal_Int16 nInitRole, const SwFlyFrame* pFlyFrame ) : SwAccessibleContext( pInitMap, nInitRole, pFlyFrame ), diff --git a/sw/source/core/access/accframebase.hxx b/sw/source/core/access/accframebase.hxx index 6809fb0d4e7a..96a3a4bcd95b 100644 --- a/sw/source/core/access/accframebase.hxx +++ b/sw/source/core/access/accframebase.hxx @@ -48,7 +48,7 @@ protected: virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override; public: - SwAccessibleFrameBase( SwAccessibleMap* pInitMap, + SwAccessibleFrameBase(std::shared_ptr<SwAccessibleMap> const& pInitMap, sal_Int16 nInitRole, const SwFlyFrame *pFlyFrame ); diff --git a/sw/source/core/access/accgraphic.cxx b/sw/source/core/access/accgraphic.cxx index 6c6a697d9adc..70ae68030f6b 100644 --- a/sw/source/core/access/accgraphic.cxx +++ b/sw/source/core/access/accgraphic.cxx @@ -32,7 +32,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::accessibility; SwAccessibleGraphic::SwAccessibleGraphic( - SwAccessibleMap* pInitMap, + std::shared_ptr<SwAccessibleMap> const& pInitMap, const SwFlyFrame* pFlyFrame ) : SwAccessibleNoTextFrame( pInitMap, AccessibleRole::GRAPHIC, pFlyFrame ) { diff --git a/sw/source/core/access/accgraphic.hxx b/sw/source/core/access/accgraphic.hxx index 754604d25511..da2b59da4659 100644 --- a/sw/source/core/access/accgraphic.hxx +++ b/sw/source/core/access/accgraphic.hxx @@ -28,7 +28,7 @@ protected: virtual ~SwAccessibleGraphic() override; public: - SwAccessibleGraphic( SwAccessibleMap* pInitMap, + SwAccessibleGraphic(std::shared_ptr<SwAccessibleMap> const& pInitMap, const SwFlyFrame *pFlyFrame ); // XServiceInfo diff --git a/sw/source/core/access/accheaderfooter.cxx b/sw/source/core/access/accheaderfooter.cxx index 36327d58f70f..1fb6783fc59b 100644 --- a/sw/source/core/access/accheaderfooter.cxx +++ b/sw/source/core/access/accheaderfooter.cxx @@ -37,7 +37,7 @@ const sal_Char sImplementationNameHeader[] = "com.sun.star.comp.Writer.SwAccessi const sal_Char sImplementationNameFooter[] = "com.sun.star.comp.Writer.SwAccessibleFooterView"; SwAccessibleHeaderFooter::SwAccessibleHeaderFooter( - SwAccessibleMap* pInitMap, + std::shared_ptr<SwAccessibleMap> const& pInitMap, const SwHeaderFrame* pHdFrame ) : SwAccessibleContext( pInitMap, AccessibleRole::HEADER, pHdFrame ) { @@ -48,7 +48,7 @@ SwAccessibleHeaderFooter::SwAccessibleHeaderFooter( } SwAccessibleHeaderFooter::SwAccessibleHeaderFooter( - SwAccessibleMap* pInitMap, + std::shared_ptr<SwAccessibleMap> const& pInitMap, const SwFooterFrame* pFtFrame ) : SwAccessibleContext( pInitMap, AccessibleRole::FOOTER, pFtFrame ) { diff --git a/sw/source/core/access/accheaderfooter.hxx b/sw/source/core/access/accheaderfooter.hxx index fded39e7d55a..f42aa321c3eb 100644 --- a/sw/source/core/access/accheaderfooter.hxx +++ b/sw/source/core/access/accheaderfooter.hxx @@ -31,9 +31,9 @@ protected: virtual ~SwAccessibleHeaderFooter() override; public: - SwAccessibleHeaderFooter( SwAccessibleMap* pInitMap, + SwAccessibleHeaderFooter( std::shared_ptr<SwAccessibleMap> const& pInitMap, const SwHeaderFrame* pHdFrame ); - SwAccessibleHeaderFooter( SwAccessibleMap* pInitMap, + SwAccessibleHeaderFooter( std::shared_ptr<SwAccessibleMap> const& pInitMap, const SwFooterFrame* pFtFrame ); // XAccessibleContext diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 2f23331648e0..114e7f17b4a8 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -1655,6 +1655,7 @@ SwAccessibleMap::SwAccessibleMap( SwViewShell *pSh ) : SwAccessibleMap::~SwAccessibleMap() { + DBG_TESTSOLARMUTEX(); uno::Reference < XAccessible > xAcc; { osl::MutexGuard aGuard( maMutex ); @@ -1665,7 +1666,8 @@ SwAccessibleMap::~SwAccessibleMap() if( aIter != mpFrameMap->end() ) xAcc = (*aIter).second; if( !xAcc.is() ) - xAcc = new SwAccessibleDocument( this ); + assert(false); // let's hope this can't happen? the vcl::Window apparently owns the top-level + //xAcc = new SwAccessibleDocument(shared_from_this()); } } @@ -1683,7 +1685,8 @@ SwAccessibleMap::~SwAccessibleMap() if( xTmp.is() ) { SwAccessibleContext *pTmp = static_cast< SwAccessibleContext * >( xTmp.get() ); - pTmp->SetMap(nullptr); + // TODO is this still needed + pTmp->ClearMapPointer(); } ++aIter; } @@ -1691,8 +1694,6 @@ SwAccessibleMap::~SwAccessibleMap() { osl::MutexGuard aGuard( maMutex ); #if OSL_DEBUG_LEVEL > 0 - SAL_WARN_IF(!(!mpFrameMap || mpFrameMap->empty()), "sw.a11y", - "Frame map should be empty after disposing the root frame"); if( mpFrameMap ) { SwAccessibleContextMap_Impl::iterator aIter = mpFrameMap->begin(); @@ -1708,8 +1709,6 @@ SwAccessibleMap::~SwAccessibleMap() ++aIter; } } - SAL_WARN_IF(!(!mpShapeMap || mpShapeMap->empty()), "sw.a11y", - "Object map should be empty after disposing the root frame"); if( mpShapeMap ) { SwAccessibleShapeMap_Impl::iterator aIter = mpShapeMap->begin(); @@ -1725,6 +1724,10 @@ SwAccessibleMap::~SwAccessibleMap() ++aIter; } } + assert((!mpFrameMap || mpFrameMap->empty()) && + "Frame map should be empty after disposing the root frame"); + assert((!mpShapeMap || mpShapeMap->empty()) && + "Object map should be empty after disposing the root frame"); #endif delete mpFrameMap; mpFrameMap = nullptr; @@ -1786,9 +1789,9 @@ uno::Reference< XAccessible > SwAccessibleMap::GetDocumentView_( else { if( bPagePreview ) - xAcc = new SwAccessiblePreview( this ); + xAcc = new SwAccessiblePreview(shared_from_this()); else - xAcc = new SwAccessibleDocument( this ); + xAcc = new SwAccessibleDocument(shared_from_this()); if( aIter != mpFrameMap->end() ) { @@ -1860,15 +1863,15 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( const SwFrame *pFrame, switch( pFrame->GetType() ) { case SwFrameType::Txt: - pAcc = new SwAccessibleParagraph( this, + pAcc = new SwAccessibleParagraph(shared_from_this(), static_cast< const SwTextFrame& >( *pFrame ) ); break; case SwFrameType::Header: - pAcc = new SwAccessibleHeaderFooter( this, + pAcc = new SwAccessibleHeaderFooter(shared_from_this(), static_cast< const SwHeaderFrame *>( pFrame ) ); break; case SwFrameType::Footer: - pAcc = new SwAccessibleHeaderFooter( this, + pAcc = new SwAccessibleHeaderFooter(shared_from_this(), static_cast< const SwFooterFrame *>( pFrame ) ); break; case SwFrameType::Ftn: @@ -1877,7 +1880,7 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( const SwFrame *pFrame, static_cast < const SwFootnoteFrame * >( pFrame ); bool bIsEndnote = SwAccessibleFootnote::IsEndnote( pFootnoteFrame ); - pAcc = new SwAccessibleFootnote( this, bIsEndnote, + pAcc = new SwAccessibleFootnote(shared_from_this(), bIsEndnote, /*(bIsEndnote ? mnEndnote++ : mnFootnote++),*/ pFootnoteFrame ); } @@ -1889,29 +1892,29 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( const SwFrame *pFrame, switch( SwAccessibleFrameBase::GetNodeType( pFlyFrame ) ) { case ND_GRFNODE: - pAcc = new SwAccessibleGraphic( this, pFlyFrame ); + pAcc = new SwAccessibleGraphic(shared_from_this(), pFlyFrame ); break; case ND_OLENODE: - pAcc = new SwAccessibleEmbeddedObject( this, pFlyFrame ); + pAcc = new SwAccessibleEmbeddedObject(shared_from_this(), pFlyFrame ); break; default: - pAcc = new SwAccessibleTextFrame( this, *pFlyFrame ); + pAcc = new SwAccessibleTextFrame(shared_from_this(), *pFlyFrame ); break; } } break; case SwFrameType::Cell: - pAcc = new SwAccessibleCell( this, + pAcc = new SwAccessibleCell(shared_from_this(), static_cast< const SwCellFrame *>( pFrame ) ); break; case SwFrameType::Tab: - pAcc = new SwAccessibleTable( this, + pAcc = new SwAccessibleTable(shared_from_this(), static_cast< const SwTabFrame *>( pFrame ) ); break; case SwFrameType::Page: OSL_ENSURE( GetShell()->IsPreview(), "accessible page frames only in PagePreview" ); - pAcc = new SwAccessiblePage( this, pFrame ); + pAcc = new SwAccessiblePage(shared_from_this(), pFrame); break; default: break; } diff --git a/sw/source/core/access/accnotextframe.cxx b/sw/source/core/access/accnotextframe.cxx index f07962c101b0..aaa7b103f1e9 100644 --- a/sw/source/core/access/accnotextframe.cxx +++ b/sw/source/core/access/accnotextframe.cxx @@ -60,7 +60,7 @@ const SwNoTextNode *SwAccessibleNoTextFrame::GetNoTextNode() const } SwAccessibleNoTextFrame::SwAccessibleNoTextFrame( - SwAccessibleMap* pInitMap, + std::shared_ptr<SwAccessibleMap> const& pInitMap, sal_Int16 nInitRole, const SwFlyFrame* pFlyFrame ) : SwAccessibleFrameBase( pInitMap, nInitRole, pFlyFrame ), diff --git a/sw/source/core/access/accnotextframe.hxx b/sw/source/core/access/accnotextframe.hxx index d4b35287c9cd..cb5aee70d454 100644 --- a/sw/source/core/access/accnotextframe.hxx +++ b/sw/source/core/access/accnotextframe.hxx @@ -51,7 +51,7 @@ protected: virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override; public: - SwAccessibleNoTextFrame( SwAccessibleMap* pInitMap, + SwAccessibleNoTextFrame( std::shared_ptr<SwAccessibleMap> const& pInitMap, sal_Int16 nInitRole, const SwFlyFrame *pFlyFrame ); diff --git a/sw/source/core/access/accpage.cxx b/sw/source/core/access/accpage.cxx index 0bf30f7be3ec..7bc46531c3d1 100644 --- a/sw/source/core/access/accpage.cxx +++ b/sw/source/core/access/accpage.cxx @@ -108,7 +108,7 @@ void SwAccessiblePage::InvalidateFocus_() } } -SwAccessiblePage::SwAccessiblePage( SwAccessibleMap* pInitMap, +SwAccessiblePage::SwAccessiblePage(std::shared_ptr<SwAccessibleMap> const& pInitMap, const SwFrame* pFrame ) : SwAccessibleContext( pInitMap, AccessibleRole::PANEL, pFrame ) , bIsSelected( false ) diff --git a/sw/source/core/access/accpage.hxx b/sw/source/core/access/accpage.hxx index ed6e25cbd3f4..1b1522700c4e 100644 --- a/sw/source/core/access/accpage.hxx +++ b/sw/source/core/access/accpage.hxx @@ -51,7 +51,8 @@ protected: public: // convenience constructor to avoid typecast; // may only be called with SwPageFrame argument - SwAccessiblePage( SwAccessibleMap* pInitMap, const SwFrame* pFrame ); + SwAccessiblePage(std::shared_ptr<SwAccessibleMap> const& pInitMap, + const SwFrame* pFrame); // XAccessibleContext methods that need to be overridden diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 935495573295..8148dcac195a 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -531,7 +531,7 @@ void SwAccessibleParagraph::InvalidateFocus_() } SwAccessibleParagraph::SwAccessibleParagraph( - SwAccessibleMap* pInitMap, + std::shared_ptr<SwAccessibleMap> const& pInitMap, const SwTextFrame& rTextFrame ) : SwClient( const_cast<SwTextNode*>(rTextFrame.GetTextNode()) ) // #i108125# , SwAccessibleContext( pInitMap, AccessibleRole::PARAGRAPH, &rTextFrame ) diff --git a/sw/source/core/access/accpara.hxx b/sw/source/core/access/accpara.hxx index 4843175108a6..8062dbaf80eb 100644 --- a/sw/source/core/access/accpara.hxx +++ b/sw/source/core/access/accpara.hxx @@ -236,7 +236,7 @@ protected: public: - SwAccessibleParagraph( SwAccessibleMap* pInitMap, + SwAccessibleParagraph( std::shared_ptr<SwAccessibleMap> const& pInitMap, const SwTextFrame& rTextFrame ); inline operator css::accessibility::XAccessibleText *(); diff --git a/sw/source/core/access/accpreview.cxx b/sw/source/core/access/accpreview.cxx index 269e1ed82c10..38169784c5d0 100644 --- a/sw/source/core/access/accpreview.cxx +++ b/sw/source/core/access/accpreview.cxx @@ -29,8 +29,8 @@ const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleDoc using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::Sequence; -SwAccessiblePreview::SwAccessiblePreview( SwAccessibleMap *pMp ) : - SwAccessibleDocumentBase( pMp ) +SwAccessiblePreview::SwAccessiblePreview(std::shared_ptr<SwAccessibleMap> const& pMap) + : SwAccessibleDocumentBase(pMap) { SetName( GetResource( STR_ACCESS_PREVIEW_DOC_NAME ) ); } diff --git a/sw/source/core/access/accpreview.hxx b/sw/source/core/access/accpreview.hxx index ad807fbc7ac7..5be8b5a9af6e 100644 --- a/sw/source/core/access/accpreview.hxx +++ b/sw/source/core/access/accpreview.hxx @@ -35,7 +35,7 @@ class SwAccessiblePreview : public SwAccessibleDocumentBase virtual ~SwAccessiblePreview() override; public: - SwAccessiblePreview( SwAccessibleMap *pMap ); + SwAccessiblePreview(std::shared_ptr<SwAccessibleMap> const& pMap); // XServiceInfo diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx index 0402dd153d4e..6d8bf2ecede5 100644 --- a/sw/source/core/access/acctable.cxx +++ b/sw/source/core/access/acctable.cxx @@ -763,7 +763,7 @@ void SwAccessibleTable::GetStates( } SwAccessibleTable::SwAccessibleTable( - SwAccessibleMap* pInitMap, + std::shared_ptr<SwAccessibleMap> const& pInitMap, const SwTabFrame* pTabFrame ) : SwAccessibleContext( pInitMap, AccessibleRole::TABLE, pTabFrame ), mpTableData( nullptr ) @@ -1086,7 +1086,8 @@ uno::Reference< XAccessibleTable > SAL_CALL // #i87532# - assure that return accessible object is empty, // if no column header exists. SwAccessibleTableColHeaders* pTableColHeaders = - new SwAccessibleTableColHeaders( GetMap(), static_cast< const SwTabFrame *>( GetFrame() ) ); + new SwAccessibleTableColHeaders(GetMap()->shared_from_this(), + static_cast<const SwTabFrame *>(GetFrame())); uno::Reference< XAccessibleTable > xTableColumnHeaders( pTableColHeaders ); if ( pTableColHeaders->getAccessibleChildCount() <= 0 ) { @@ -1854,9 +1855,10 @@ sal_Bool SAL_CALL SwAccessibleTable::unselectColumn( sal_Int32 column ) } // #i77106# - implementation of class <SwAccessibleTableColHeaders> -SwAccessibleTableColHeaders::SwAccessibleTableColHeaders( SwAccessibleMap *pMap2, - const SwTabFrame *pTabFrame ) - : SwAccessibleTable( pMap2, pTabFrame ) +SwAccessibleTableColHeaders::SwAccessibleTableColHeaders( + std::shared_ptr<SwAccessibleMap> const& pMap, + const SwTabFrame *const pTabFrame) + : SwAccessibleTable(pMap, pTabFrame) { SolarMutexGuard aGuard; diff --git a/sw/source/core/access/acctable.hxx b/sw/source/core/access/acctable.hxx index 73c3b2a121a7..21165deeea9f 100644 --- a/sw/source/core/access/acctable.hxx +++ b/sw/source/core/access/acctable.hxx @@ -86,7 +86,8 @@ protected: virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override; public: - SwAccessibleTable( SwAccessibleMap* pInitMap, const SwTabFrame* pTableFrame ); + SwAccessibleTable(std::shared_ptr<SwAccessibleMap> const& pInitMap, + const SwTabFrame* pTableFrame); // XInterface @@ -292,7 +293,8 @@ protected: virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override; public: - SwAccessibleTableColHeaders( SwAccessibleMap *pMap, const SwTabFrame *pTabFrame ); + SwAccessibleTableColHeaders(std::shared_ptr<SwAccessibleMap> const& pMap, + const SwTabFrame *pTabFrame); // XInterface diff --git a/sw/source/core/access/acctextframe.cxx b/sw/source/core/access/acctextframe.cxx index b8e962e1dd68..8a5418043699 100644 --- a/sw/source/core/access/acctextframe.cxx +++ b/sw/source/core/access/acctextframe.cxx @@ -44,7 +44,7 @@ using utl::AccessibleRelationSetHelper; using ::com::sun::star::accessibility::XAccessibleContext; SwAccessibleTextFrame::SwAccessibleTextFrame( - SwAccessibleMap* pInitMap, + std::shared_ptr<SwAccessibleMap> const& pInitMap, const SwFlyFrame& rFlyFrame ) : SwAccessibleFrameBase( pInitMap, AccessibleRole::TEXT_FRAME, &rFlyFrame ), msTitle(), diff --git a/sw/source/core/access/acctextframe.hxx b/sw/source/core/access/acctextframe.hxx index bfe74eeb0038..eba7b36a7dcc 100644 --- a/sw/source/core/access/acctextframe.hxx +++ b/sw/source/core/access/acctextframe.hxx @@ -43,7 +43,8 @@ protected: virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override; public: - SwAccessibleTextFrame( SwAccessibleMap* pInitMap, const SwFlyFrame& rFlyFrame ); + SwAccessibleTextFrame(std::shared_ptr<SwAccessibleMap> const& pInitMap, + const SwFlyFrame& rFlyFrame); virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx index 465a68fada6b..4a2ab4cb887a 100644 --- a/sw/source/core/inc/viewimp.hxx +++ b/sw/source/core/inc/viewimp.hxx @@ -74,7 +74,9 @@ class SwViewShellImp // Is registered by the SwLayAction ctor and deregistered by the dtor SwLayIdle *m_pIdleAct; // The same as SwLayAction for SwLayIdle - SwAccessibleMap *m_pAccessibleMap; // Accessible wrappers + /// note: the map is *uniquely* owned here - the shared_ptr is only + /// used so that SwAccessibleContext can check via weak_ptr that it's alive + std::shared_ptr<SwAccessibleMap> m_pAccessibleMap; bool m_bFirstPageInvalid : 1; // Pointer to the first Page invalid? bool m_bResetHdlHiddenPaint : 1; // Ditto diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx index 335f45a38d1a..6baeba639baa 100644 --- a/sw/source/core/view/viewimp.cxx +++ b/sw/source/core/view/viewimp.cxx @@ -106,7 +106,7 @@ SwViewShellImp::SwViewShellImp( SwViewShell *pParent ) : SwViewShellImp::~SwViewShellImp() { - delete m_pAccessibleMap; + m_pAccessibleMap.reset(); delete m_pPagePreviewLayout; @@ -449,9 +449,9 @@ void SwViewShellImp::InvalidateAccessiblePreviewSelection( sal_uInt16 nSelPage ) SwAccessibleMap *SwViewShellImp::CreateAccessibleMap() { - OSL_ENSURE( !m_pAccessibleMap, "accessible map exists" ); - m_pAccessibleMap = new SwAccessibleMap( GetShell() ); - return m_pAccessibleMap; + assert(!m_pAccessibleMap); + m_pAccessibleMap.reset(new SwAccessibleMap(GetShell())); + return m_pAccessibleMap.get(); } void SwViewShellImp::FireAccessibleEvents() commit f990a468ef28295c3db885230772e559f0704e83 Author: Jean-Pierre Ledure <[email protected]> Date: Sun Mar 26 12:34:21 2017 +0200 Access2Base Missing parentheses - tdf#106710 Due to more severe Basic interpreter on final parentheses missing parentheses were revealed (complement to commit cc16dfb11dfc275317bb535a62b11935c562b670) Change-Id: I45b43bca4a5ee938e9c4dc0b0f8b2d5856f710da Reviewed-on: https://gerrit.libreoffice.org/35717 Tested-by: Jenkins <[email protected]> Reviewed-by: Mike Kaganski <[email protected]> (cherry picked from commit c317670eb6b5d29f0447feff0c33d528a88f4c8a) diff --git a/wizards/source/access2base/Application.xba b/wizards/source/access2base/Application.xba index 783fca73541e..3383e7bd009a 100644 --- a/wizards/source/access2base/Application.xba +++ b/wizards/source/access2base/Application.xba @@ -1147,7 +1147,7 @@ Const cstThisSub = "OpenDatabase" Set oBaseContext = CreateUnoService("com.sun.star.sdb.DatabaseContext") sDbNames() = oBaseContext.getElementNames() bFound = False - For i = 0 To UBound(sDbNames() ' Enumerate registered databases and check non case-sensitive equality + For i = 0 To UBound(sDbNames()) ' Enumerate registered databases and check non case-sensitive equality If UCase(sDbNames(i)) = UCase(pvDatabaseURL) Then sDatabaseURL = sDbNames(i) Set oBaseSource = oBaseContext.getByName(sDatabaseURL) commit 95d4a75be880f069795ee98be4234c85573f4b17 Author: Caolán McNamara <[email protected]> Date: Thu Mar 23 16:06:18 2017 +0000 Resolves: tdf#106461 use a row height of max of edit and listbox height not just take the listbox because edits can be taller and result in overlaps Change-Id: I6067b384484d933727220febda723bc9e8c5e90b (cherry picked from commit 5013abeb191cdc6f8375f107a4d30abd802547d2) Reviewed-on: https://gerrit.libreoffice.org/35596 Tested-by: Jenkins <[email protected]> Reviewed-by: David Tardon <[email protected]> (cherry picked from commit 910582360d2a2f0455841b2cd0c3cc2c7ed08344) diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx index 9d6b899ce0e2..93e901f98131 100644 --- a/extensions/source/propctrlr/browserlistbox.cxx +++ b/extensions/source/propctrlr/browserlistbox.cxx @@ -332,9 +332,11 @@ namespace pcr ,m_bUpdate(true) ,m_pControlContextImpl( new PropertyControlContext_Impl( *this ) ) { - ScopedVclPtrInstance< ListBox > aListBox(this,WB_DROPDOWN); - aListBox->SetPosSizePixel(Point(0,0),Size(100,100)); - m_nRowHeight = aListBox->GetSizePixel().Height()+2; + ScopedVclPtrInstance<ListBox> aListBox(this, WB_DROPDOWN); + ScopedVclPtrInstance<Edit> aEditBox(this); + m_nRowHeight = std::max(aListBox->get_preferred_size().Height(), + aEditBox->get_preferred_size().Height()); + m_nRowHeight += 2; SetBackground( pParent->GetBackground() ); m_aLinesPlayground->SetBackground( GetBackground() ); @@ -345,7 +347,6 @@ namespace pcr m_aVScroll->SetScrollHdl(LINK(this, OBrowserListBox, ScrollHdl)); } - OBrowserListBox::~OBrowserListBox() { disposeOnce(); commit d7e64d62071757ee7613c82925d978a73b46a2f8 Author: Caolán McNamara <[email protected]> Date: Sun Mar 26 21:21:22 2017 +0100 ofz#944 avoid recurse to death (cherry picked from commit 7eb92eea21e2af47b17c9901107f6e4833567928) Change-Id: I27ed8cf5e8296a1ad91c33614913fc7af4a56d45 Reviewed-on: https://gerrit.libreoffice.org/35724 Tested-by: Jenkins <[email protected]> Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit c2a9387ab259f12c7ee724f7f5be52b8d8f7ed64) diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx index ef95f678ad2a..d1616b815a03 100644 --- a/lotuswordpro/source/filter/lwpframelayout.cxx +++ b/lotuswordpro/source/filter/lwpframelayout.cxx @@ -761,7 +761,7 @@ void LwpFrameLink::Read(LwpObjectStream* pStrm) } LwpFrameLayout::LwpFrameLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm) - : LwpPlacableLayout(objHdr, pStrm), m_pFrame(nullptr) + : LwpPlacableLayout(objHdr, pStrm), m_pFrame(nullptr), m_bGettingMaxWidth(false) { } @@ -946,6 +946,10 @@ double LwpFrameLayout::GetWidth() */ double LwpFrameLayout::GetMaxWidth() { + if (m_bGettingMaxWidth) + throw std::runtime_error("recursive GetMaxWidth"); + + m_bGettingMaxWidth = true; double fActualWidth = 0; rtl::Reference<LwpVirtualLayout> xLayout(GetContainerLayout()); LwpMiddleLayout* pParent = dynamic_cast<LwpMiddleLayout*>(xLayout.get()); @@ -974,6 +978,7 @@ double LwpFrameLayout::GetMaxWidth() fActualWidth = fParentWidth - fXOffset - fParentMarginRight - fWrapRight; } + m_bGettingMaxWidth = false; return fActualWidth; } diff --git a/lotuswordpro/source/filter/lwpframelayout.hxx b/lotuswordpro/source/filter/lwpframelayout.hxx index 99b3a215ccc3..5b11c146e0f4 100644 --- a/lotuswordpro/source/filter/lwpframelayout.hxx +++ b/lotuswordpro/source/filter/lwpframelayout.hxx @@ -141,6 +141,7 @@ private: private: LwpFrameLink m_Link; LwpFrame* m_pFrame; + bool m_bGettingMaxWidth; }; /** commit ee9cfb0703a60faaf50bec36e637bc592acca9a6 Author: Caolán McNamara <[email protected]> Date: Fri Mar 24 13:03:50 2017 +0000 Resolves: tdf#106724 crash when Title property doesn't already exist because we just write past the end instead of resizing before hand (cherry picked from commit 4e32e8900e59f9751a60d9fdef80cdf7d500f72f) Change-Id: I4742980a331b14ca39aff8aa6cfc27db154091ff Reviewed-on: https://gerrit.libreoffice.org/35651 Tested-by: Jenkins <[email protected]> Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit 1255360bffebef0f0521b00c4e5af57e6fe09e6b) diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 1edf7f20d553..bebfaa7f8e02 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -4346,31 +4346,31 @@ void DomainMapper_Impl::SetFieldResult(OUString const& rResult) uno::Sequence<beans::PropertyValue> aValues ; aProperty >>= aValues; beans::PropertyValue propertyVal; - bool bTitleFound = false; - int i=0; - for (; i < aValues.getLength(); i++) + sal_Int32 nTitleFoundIndex = -1; + for (sal_Int32 i = 0; i < aValues.getLength(); ++i) { propertyVal = aValues[i]; - if(propertyVal.Name == "Title") + if (propertyVal.Name == "Title") { - bTitleFound = true; + nTitleFoundIndex = i; break; } } - if(bTitleFound) + if (nTitleFoundIndex != -1) { OUString titleStr; uno::Any aValue(propertyVal.Value); aValue >>= titleStr; titleStr = titleStr + rResult; propertyVal.Value = uno::makeAny(titleStr); - aValues[i] = propertyVal; + aValues[nTitleFoundIndex] = propertyVal; } else { + aValues.realloc(aValues.getLength() + 1); propertyVal.Name = "Title"; propertyVal.Value = uno::makeAny(rResult); - aValues[i] = propertyVal; + aValues[aValues.getLength() - 1] = propertyVal; } xFieldProperties->setPropertyValue("Fields", uno::makeAny(aValues)); commit ebae2819348ec963389fd90c3579df988d77b32d Author: Caolán McNamara <[email protected]> Date: Mon Mar 27 09:25:00 2017 +0100 Resolves: tdf#106729 ensure VistaFilePicker init before access (cherry picked from commit a15ec82edebf14baa41a888ead7da8e0556ab0bb) Change-Id: I238599cf5ed464c4bb99a894ac47126fbc32796d Reviewed-on: https://gerrit.libreoffice.org/35745 Reviewed-by: Adolfo Jayme Barrientos <[email protected]> Tested-by: Adolfo Jayme Barrientos <[email protected]> (cherry picked from commit de87afd6d8302d2c000be39010196cb1aef865c1) diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.cxx b/fpicker/source/win32/filepicker/VistaFilePicker.cxx index c3e95b51ac1b..a3e906be0115 100644 --- a/fpicker/source/win32/filepicker/VistaFilePicker.cxx +++ b/fpicker/source/win32/filepicker/VistaFilePicker.cxx @@ -110,6 +110,8 @@ void SAL_CALL VistaFilePicker::disposing(const css::lang::EventObject& /*aEvent* void SAL_CALL VistaFilePicker::setMultiSelectionMode(sal_Bool bMode) throw(css::uno::RuntimeException) { + ensureInit(); + RequestRef rRequest(new Request()); rRequest->setRequest (VistaFilePickerImpl::E_SET_MULTISELECTION_MODE); rRequest->setArgument(PROP_MULTISELECTION_MODE, bMode); @@ -120,6 +122,8 @@ void SAL_CALL VistaFilePicker::setMultiSelectionMode(sal_Bool bMode) void SAL_CALL VistaFilePicker::setTitle(const OUString& sTitle) throw(css::uno::RuntimeException) { + ensureInit(); + RequestRef rRequest(new Request()); rRequest->setRequest (VistaFilePickerImpl::E_SET_TITLE); rRequest->setArgument(PROP_TITLE, sTitle); @@ -178,6 +182,8 @@ void SAL_CALL VistaFilePicker::appendFilterGroup(const OUString& void SAL_CALL VistaFilePicker::setDefaultName(const OUString& sName ) throw(css::uno::RuntimeException) { + ensureInit(); + RequestRef rRequest(new Request()); rRequest->setRequest (VistaFilePickerImpl::E_SET_DEFAULT_NAME); rRequest->setArgument(PROP_FILENAME, sName); @@ -189,6 +195,8 @@ void SAL_CALL VistaFilePicker::setDisplayDirectory(const OUString& sDirectory) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException ) { + ensureInit(); + bool bChanged = officecfg::Office::Common::Path::Info::WorkPathChanged::get( comphelper::getComponentContext(m_xSMGR)); if (bChanged ) @@ -212,6 +220,8 @@ void SAL_CALL VistaFilePicker::setDisplayDirectory(const OUString& sDirectory) OUString SAL_CALL VistaFilePicker::getDisplayDirectory() throw(css::uno::RuntimeException) { + ensureInit(); + RequestRef rRequest(new Request()); rRequest->setRequest (VistaFilePickerImpl::E_GET_DIRECTORY); m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::BLOCKED); @@ -246,8 +256,7 @@ css::uno::Sequence< OUString > SAL_CALL VistaFilePicker::getSelectedFiles() return lFiles; } -::sal_Int16 SAL_CALL VistaFilePicker::execute() - throw(css::uno::RuntimeException) +void VistaFilePicker::ensureInit() { bool bInitialized(false); { @@ -262,6 +271,12 @@ css::uno::Sequence< OUString > SAL_CALL VistaFilePicker::getSelectedFiles() aInitArguments[0] <<= nTemplateDescription; initialize(aInitArguments); } +} + +::sal_Int16 SAL_CALL VistaFilePicker::execute() + throw(css::uno::RuntimeException) +{ + ensureInit(); RequestRef rRequest(new Request()); rRequest->setRequest (VistaFilePickerImpl::E_SHOW_DIALOG_MODAL); diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.hxx b/fpicker/source/win32/filepicker/VistaFilePicker.hxx index deb15ef6ee3e..31e239403aa7 100644 --- a/fpicker/source/win32/filepicker/VistaFilePicker.hxx +++ b/fpicker/source/win32/filepicker/VistaFilePicker.hxx @@ -249,6 +249,8 @@ public: using WeakComponentImplHelperBase::disposing; + void ensureInit(); + private: commit af0bd8e2d9f532cdda3d8ed5d32056cf65fc3c44 Author: László Németh <[email protected]> Date: Fri Mar 24 15:26:49 2017 +0100 tdf#106751 fix regressions in Hungarian spell checking using recent fixes of Hunspell code base Change-Id: I180a2ecba924180419c5eb1a0e78b5c84e7242c4 Reviewed-on: https://gerrit.libreoffice.org/35670 Tested-by: Jenkins <[email protected]> Tested-by: László Németh <[email protected]> Reviewed-by: László Németh <[email protected]> Reviewed-by: Andras Timar <[email protected]> (cherry picked from commit 23c028ba014f521bf1b70c83439e0915e56c296f) diff --git a/external/hunspell/0002-fix-other-regression-in-compounding.patch b/external/hunspell/0002-fix-other-regression-in-compounding.patch new file mode 100644 index 000000000000..cbf29e54f93a --- /dev/null +++ b/external/hunspell/0002-fix-other-regression-in-compounding.patch @@ -0,0 +1,43 @@ +From 1fada01663b29b57c010a9c274e45a5cf9ecf222 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?L=C3=A1szl=C3=B3=20N=C3=A9meth?= + <[email protected]> +Date: Sun, 19 Mar 2017 13:19:29 +0100 +Subject: [PATCH 2/7] fix other regression in compounding +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Allow compound words again with +starting "kor", "alak", "asszony", "úr" +related to the "REP kor _kor" etc. rules +using the Hungarian spelling dictionary. + +regression from... + +commit 73b1cad1af7ab94252f75784fa6724cf062a6966 +Author: Martin Hosken <[email protected]> +Date: Mon Apr 18 16:28:26 2016 +0700 + + Add support for bounded conversion +--- + src/hunspell/affixmgr.cxx | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/hunspell/affixmgr.cxx b/src/hunspell/affixmgr.cxx +index 78c70e7..ec2093d 100644 +--- a/src/hunspell/affixmgr.cxx ++++ b/src/hunspell/affixmgr.cxx +@@ -1290,8 +1290,8 @@ int AffixMgr::cpdrep_check(const char* word, int wl) { + // search every occurence of the pattern in the word + while ((r = strstr(r, reptable[i].pattern.c_str())) != NULL) { + std::string candidate(word); +- size_t type = r == word ? 1 : 0; +- if (r - word + reptable[i].pattern.size() == lenp) ++ size_t type = r == word && langnum != LANG_hu ? 1 : 0; ++ if (r - word + reptable[i].pattern.size() == lenp && langnum != LANG_hu) + type += 2; + candidate.replace(r - word, lenp, reptable[i].outstrings[type]); + if (candidate_check(candidate.c_str(), candidate.size())) +-- +2.7.4 + diff --git a/external/hunspell/0005-fix-syllable-counting-in-compound-word-handling.patch b/external/hunspell/0005-fix-syllable-counting-in-compound-word-handling.patch new file mode 100644 index 000000000000..670d938e5441 --- /dev/null +++ b/external/hunspell/0005-fix-syllable-counting-in-compound-word-handling.patch @@ -0,0 +1,66 @@ +From f4ec6a283f972c82d068f4472320d424c40d45cb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?L=C3=A1szl=C3=B3=20N=C3=A9meth?= + <[email protected]> +Date: Thu, 23 Mar 2017 16:40:52 +0100 +Subject: [PATCH 5/7] fix syllable counting in compound word handling +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Note: one of the fixed regressions is related to an old +hidden mistake: using clen instead of blen of the stem +word lengths was indifferent with the original get_syllable(), +because blen == clen at 8-bit encodings, and UTF-8 +words were handled by null-termination. Implementing Unicode +support in Hunspell, clen was changed only in +compound_check_morph() to blen accidentally, but not +in compound_check(), resulting problems from the +recent std::string conversion. + +Now this commit is a real fix for the regression from the +commit c63c93237e4decdba5544a96093448605ac549c2, +instead of the following bad fix: + +commit d06b0c57ae87ee8743f1bf53f80c1f8e364db619 +Author: László Németh <[email protected]> +Date: Fri Mar 17 15:11:23 2017 +0100 + + fix Hungarian compound word handling +--- + src/hunspell/affixmgr.cxx | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/hunspell/affixmgr.cxx b/src/hunspell/affixmgr.cxx +index 2ed8233..3d65539 100644 +--- a/src/hunspell/affixmgr.cxx ++++ b/src/hunspell/affixmgr.cxx +@@ -1816,7 +1816,7 @@ struct hentry* AffixMgr::compound_check(const std::string& word, + // LANG_hu section: spec. Hungarian rule + if (langnum == LANG_hu) { + // calculate syllable number of the word +- numsyllable += get_syllable(st.substr(i)); ++ numsyllable += get_syllable(st.substr(0, i)); + // + 1 word, if syllable number of the prefix > 1 (hungarian + // convention) + if (pfx && (get_syllable(pfx->getKey()) > 1)) +@@ -1901,7 +1901,7 @@ struct hentry* AffixMgr::compound_check(const std::string& word, + (compoundend && TESTAFF(rv->astr, compoundend, rv->alen))) && + (((cpdwordmax == -1) || (wordnum + 1 < cpdwordmax)) || + ((cpdmaxsyllable != 0) && +- (numsyllable + get_syllable(std::string(HENTRY_WORD(rv), rv->clen)) <= ++ (numsyllable + get_syllable(std::string(HENTRY_WORD(rv), rv->blen)) <= + cpdmaxsyllable))) && + ( + // test CHECKCOMPOUNDPATTERN +@@ -2382,7 +2382,7 @@ int AffixMgr::compound_check_morph(const char* word, + // LANG_hu section: spec. Hungarian rule + if (langnum == LANG_hu) { + // calculate syllable number of the word +- numsyllable += get_syllable(st.substr(i)); ++ numsyllable += get_syllable(st.substr(0, i)); + + // + 1 word, if syllable number of the prefix > 1 (hungarian + // convention) +-- +2.7.4 + diff --git a/external/hunspell/UnpackedTarball_hunspell.mk b/external/hunspell/UnpackedTarball_hunspell.mk index b30bd083b407..40a4a101a8f0 100644 --- a/external/hunspell/UnpackedTarball_hunspell.mk +++ b/external/hunspell/UnpackedTarball_hunspell.mk @@ -28,6 +28,8 @@ $(eval $(call gb_UnpackedTarball_add_patches,hunspell, \ external/hunspell/0002-add-a-get_clen_and_captype-varient-that-takes-a-buff.patch \ external/hunspell/0003-hoist-string-lowering-from-ngram-to-ngsuggest.patch \ external/hunspell/0004-either-clear-will-be-called-anyway-before-use-or-its.patch \ + external/hunspell/0002-fix-other-regression-in-compounding.patch \ + external/hunspell/0005-fix-syllable-counting-in-compound-word-handling.patch \ )) # vim: set noet sw=4 ts=4: commit 2058b03f1f476d058842d4e346e9a26423e5bf7f Author: Andreas Säger <[email protected]> Date: Sun Mar 26 23:34:35 2017 +0300 tdf#106529: fix closing parentheses of bundled macros Change-Id: I43b6d4f97cb3b1cd1426e6aa7e13550d94cb7c51 Signed-off-by: Mike Kaganski <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/35726 Tested-by: Jenkins <[email protected]> (cherry picked from commit ad4857211bcc39ccd4c84c670bfab1b937f65089) Reviewed-on: https://gerrit.libreoffice.org/35741 (cherry picked from commit 7fb7b091e963d8c45abf1db1202a88f2e188e9b0) diff --git a/wizards/source/depot/Currency.xba b/wizards/source/depot/Currency.xba index 5a428d757246..d728424d3214 100644 --- a/wizards/source/depot/Currency.xba +++ b/wizards/source/depot/Currency.xba @@ -89,7 +89,7 @@ Dim bIsDocCountry as Boolean End If sCurStockIDLabel = sMarket(Index,5) sCurExtension = sMarket(Index,8) - iValueCol = Val(sMarket(Index,10) + iValueCol = Val(sMarket(Index,10)) If Instr(sCurExtension,";") <> 0 Then ' Take the german extension as the stock place is Frankfurt sCurExtension = "407" @@ -192,4 +192,4 @@ Function CheckFormatType(oStyle as Object) Dim oFormatofObject as Object oFormatofObject = oDocFormats.getByKey(oStyle.NumberFormat) CheckFormatType = INT(oFormatOfObject.Type) AND com.sun.star.util.NumberFormat.CURRENCY -End Function</script:module> \ No newline at end of file +End Function</script:module> diff --git a/wizards/source/depot/Internet.xba b/wizards/source/depot/Internet.xba index b4bcf579b808..333bcf98af89 100644 --- a/wizards/source/depot/Internet.xba +++ b/wizards/source/depot/Internet.xba @@ -223,7 +223,7 @@ Dim iCellValue as Long If iCellValue > 0 Then oCell.SetValue(oLinkSheet.GetCellByPosition(0,i).Value) Else - oCell.SetValue(StringToDate(oLinkSheet.GetCellByPosition(0,i).String) + oCell.SetValue(StringToDate(oLinkSheet.GetCellByPosition(0,i).String)) End If oCell = oSheet.GetCellbyPosition(SBVALUECOLUMN,iCurRow) oCell.SetValue(oLinkSheet.GetCellByPosition(4,i).Value) @@ -353,4 +353,4 @@ Dim bLeaveLoop as Boolean oDateCell.Annotation.SetString(NoteText) End If End Sub -</script:module> \ No newline at end of file +</script:module> diff --git a/wizards/source/formwizard/DBMeta.xba b/wizards/source/formwizard/DBMeta.xba index 68759966daf9..b0fa20b7a901 100644 --- a/wizards/source/formwizard/DBMeta.xba +++ b/wizards/source/formwizard/DBMeta.xba @@ -305,8 +305,8 @@ Dim MaxQueryIndex as Integer Dim MaxIndex as Integer Dim i as Integer Dim a as Integer - MaxTableIndex = Ubound(TableNames() - MaxQueryIndex = Ubound(QueryNames() + MaxTableIndex = Ubound(TableNames()) + MaxQueryIndex = Ubound(QueryNames()) MaxIndex = MaxTableIndex + MaxQueryIndex + 1 If MaxIndex > -1 Then Dim LocCommandTypes(MaxIndex) as Integer @@ -344,4 +344,4 @@ Function AssignFieldLength(FieldLength as Long) as Integer AssignFieldLength() = FieldLength End If End Function -</script:module> \ No newline at end of file +</script:module> diff --git a/wizards/source/formwizard/FormWizard.xba b/wizards/source/formwizard/FormWizard.xba index ffc2c4267e52..873ce4b22dea 100644 --- a/wizards/source/formwizard/FormWizard.xba +++ b/wizards/source/formwizard/FormWizard.xba @@ -153,11 +153,11 @@ Dim LocList() as String DlgFormDB.GetControl("lstTables").SelectItem(sContent, True) Else If CommandType = com.sun.star.sdb.CommandType.QUERY Then - SelIndex = IndexInArray(sContent, QueryNames() + SelIndex = IndexInArray(sContent, QueryNames()) DlgFormDB.GetControl("lstTables").SelectItemPos(SelIndex, True) ElseIf CommandType = com.sun.star.sdb.CommandType.TABLE Then - SelIndex = IndexInArray(sContent, TableNames() - DlgFormDB.GetControl("lstTables").SelectItemPos(Ubound(QueryNames()+1 + SelIndex, True) + SelIndex = IndexInArray(sContent, TableNames()) + DlgFormDB.GetControl("lstTables").SelectItemPos(Ubound(QueryNames()+1 + SelIndex, True)) End If End If CurCommandType = CommandType diff --git a/wizards/source/formwizard/Language.xba b/wizards/source/formwizard/Language.xba index 40a0e5893ac0..a175a7d2a46b 100644 --- a/wizards/source/formwizard/Language.xba +++ b/wizards/source/formwizard/Language.xba @@ -64,7 +64,7 @@ Sub LoadLanguage () sMsgErrTitleSuggestedExist = GetResText(RID_COMMON + 10) sMsgErrTitleAsTableExist = GetResText(RID_COMMON + 10) sMsgErrTitleSyntaxError = GetResText(RID_COMMON + 11) - sMsgNoConnection = GetResText(RID_COMMON + 14 + sMsgNoConnection = GetResText(RID_COMMON + 14) sMsgProgressText = GetResText(RID_FORM + 2) sMsgCreatedForm = GetResText(RID_FORM + 26) sMsgErrNameToLong = GetResText (RID_FORM + 27) @@ -129,12 +129,12 @@ Dim slblFields as String .optAlign2.Label = GetResText(RID_FORM + 34) .optAlign0.State = 1 - //FIXME: Remove this unused FNameAddOn through the file + REM//FIXME: Remove this unused FNameAddOn through the file FNameAddOn = "" IDArray = Array(36, 37, 40, 38, 39) For i = 1 To 5 - ButtonHelpText = GetResText(RID_FORM + IDArray(i-1) + ButtonHelpText = GetResText(RID_FORM + IDArray(i-1)) cmdButton = DlgFormDB.getControl("cmdArrange" & i) cmdButton.Model.ImageURL = FormPath & "Arrange_" & i & FNameAddOn & ".gif" cmdButton.Model.HelpText = ButtonHelpText @@ -156,10 +156,10 @@ Dim slblFields as String ' .cmdArrange5.HelpText = GetResText(RID_FORM + 39) sWriterFilterName = GetResText(RID_FORM + 70) End With - DlgFormDB.GetControl("cmdMoveSelected").getPeer().setProperty("AccessibleName", GetResText(RID_COMMON + 39) - DlgFormDB.GetControl("cmdRemoveSelected").getPeer().setProperty("AccessibleName", GetResText(RID_COMMON + 40) - DlgFormDB.GetControl("cmdMoveAll").getPeer().setProperty("AccessibleName", GetResText(RID_COMMON + 41) - DlgFormDB.GetControl("cmdRemoveAll").getPeer().setProperty("AccessibleName", GetResText(RID_COMMON + 42) + DlgFormDB.GetControl("cmdMoveSelected").getPeer().setProperty("AccessibleName", GetResText(RID_COMMON + 39)) + DlgFormDB.GetControl("cmdRemoveSelected").getPeer().setProperty("AccessibleName", GetResText(RID_COMMON + 40)) + DlgFormDB.GetControl("cmdMoveAll").getPeer().setProperty("AccessibleName", GetResText(RID_COMMON + 41)) + DlgFormDB.GetControl("cmdRemoveAll").getPeer().setProperty("AccessibleName", GetResText(RID_COMMON + 42)) DlgFormDB.getControl("lstFields").getPeer().setProperty("AccessibleName", DeleteStr(slblFields, "~")) DlgFormDB.getControl("lstSelFields").getPeer().setProperty("AccessibleName", DeleteStr(slblSelFields, "~"))
_______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
