diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-19 14:47:19 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-19 18:18:53 +0200 |
commit | 819b30e937d227d1458ecc22b09ef994ebe7e17e (patch) | |
tree | 9ec5bb91ed27c6dcf4674cb91488183dbccb4e49 /sw/source | |
parent | 928ce6043523a70d056d15210296d627d6223c2f (diff) |
tdf#142367 Writer crashes when opening docx
regression from
commit 5aa60be574ece81b27c8f63e6e809871c694dba0
fix leak in VCLXWindow
Make SwAnnotationWin follow the same pattern as all the other code and
return a custom accessibility object instead of trying to override the
toolkit peer object.
Change-Id: Ifa3a5da2fbbf082e6bb05281cc9d354d6ec3ba03
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115805
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/uibase/docvw/AnnotationWin.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/docvw/AnnotationWin2.cxx | 15 |
2 files changed, 10 insertions, 6 deletions
diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx index 49ea845944b8..e354a62204a8 100644 --- a/sw/source/uibase/docvw/AnnotationWin.cxx +++ b/sw/source/uibase/docvw/AnnotationWin.cxx @@ -62,6 +62,7 @@ #include "AnchorOverlayObject.hxx" #include "OverlayRanges.hxx" #include "SidebarTxtControl.hxx" +#include "SidebarWinAcc.hxx" #include <memory> diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index f463bf7597f1..b2604377e2e0 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -1376,8 +1376,8 @@ void SwAnnotationWin::ChangeSidebarItem( SwSidebarItem const & rSidebarItem ) mrSidebarItem = rSidebarItem; mpAnchorFrame = mrSidebarItem.maLayoutInfo.mpAnchorFrame; - if (SidebarWinAccessible* pAcc = dynamic_cast<SidebarWinAccessible*>(GetWindowPeer())) - pAcc->ChangeSidebarItem( mrSidebarItem ); + if (mxSidebarWinAccessible) + mxSidebarWinAccessible->ChangeSidebarItem( mrSidebarItem ); if ( bAnchorChanged ) { @@ -1389,11 +1389,14 @@ void SwAnnotationWin::ChangeSidebarItem( SwSidebarItem const & rSidebarItem ) css::uno::Reference< css::accessibility::XAccessible > SwAnnotationWin::CreateAccessible() { - rtl::Reference<SidebarWinAccessible> pAcc( new SidebarWinAccessible( *this, + // This is rather dodgy code. Normally in CreateAccessible, if we want a custom + // object, we return a custom object, but we do no override the default toolkit + // window peer. + if (!mxSidebarWinAccessible) + mxSidebarWinAccessible = new SidebarWinAccessible( *this, mrView.GetWrtShell(), - mrSidebarItem ) ); - SetWindowPeer( pAcc, pAcc.get() ); - return pAcc; + mrSidebarItem ); + return mxSidebarWinAccessible; } } // eof of namespace sw::sidebarwindows |