svtools/source/brwbox/editbrowsebox.cxx | 2 +- vcl/qt5/QtAccessibleEventListener.cxx | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-)
New commits: commit 1a637a07a0fb23f4d4bfac69378caff7ee965737 Author: Julien Nabet <serval2...@yahoo.fr> AuthorDate: Tue Jan 16 19:24:56 2024 +0100 Commit: Julien Nabet <serval2...@yahoo.fr> CommitDate: Tue Jan 16 23:27:46 2024 +0100 tdf#159213: fix Base crash when choosing "Help" in relations design (kf5) There are 2 parts here: 1) in vcl/qt5: - for release versions: avoid to call QtAccessibleRegistry::getQObject on a null object - for debug version: add an assertion on object to check it's not null 2) in svtools: the specific root cause was in EditBrowseBox::DeactivateCell, we must check m_aImpl->m_xActiveCell in addition to isAccessibleAlive() Import remark: I had a very naive/bandaid patch at the beginning this one is entirely thanks to Michael Weghorn Change-Id: I90214e9c5b7c0aa45481915d7be6020a7dc8c42e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162182 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index 927e203dd14a..515c102379b3 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -967,7 +967,7 @@ namespace svt if (!IsEditing()) return; - if ( isAccessibleAlive() ) + if ( isAccessibleAlive() && m_aImpl->m_xActiveCell) { commitBrowseBoxEvent( CHILD, Any(), Any( m_aImpl->m_xActiveCell ) ); m_aImpl->clearActiveCell(); diff --git a/vcl/qt5/QtAccessibleEventListener.cxx b/vcl/qt5/QtAccessibleEventListener.cxx index d6a404e6947e..0bf4dcddbf2d 100644 --- a/vcl/qt5/QtAccessibleEventListener.cxx +++ b/vcl/qt5/QtAccessibleEventListener.cxx @@ -213,12 +213,22 @@ void QtAccessibleEventListener::notifyEvent(const css::accessibility::Accessible Reference<XAccessible> xChild; if (aEvent.NewValue >>= xChild) { + assert(xChild.is() + && "AccessibleEventId::CHILD event NewValue without valid child set"); + // tdf#159213 for now, workaround invalid events being sent and don't crash in release builds + if (!xChild.is()) + return; QAccessible::updateAccessibility(new QAccessibleEvent( QtAccessibleRegistry::getQObject(xChild), QAccessible::ObjectCreated)); return; } if (aEvent.OldValue >>= xChild) { + assert(xChild.is() + && "AccessibleEventId::CHILD event OldValue without valid child set"); + // tdf#159213 for now, workaround invalid events being sent and don't crash in release builds + if (!xChild.is()) + return; QAccessible::updateAccessibility(new QAccessibleEvent( QtAccessibleRegistry::getQObject(xChild), QAccessible::ObjectDestroyed)); return;