svtools/source/brwbox/editbrowsebox.cxx |    2 +-
 vcl/qt5/QtAccessibleEventListener.cxx   |   10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit e5a0d2f48893af6480f5539208ee202ee536a033
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Tue Jan 16 19:24:56 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Jan 19 10:09:19 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
    (cherry picked from commit 1a637a07a0fb23f4d4bfac69378caff7ee965737)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162141
    (cherry picked from commit 491fb3b8723d6d2725326b145b35328cb89a118a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162149
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Hossein <hoss...@libreoffice.org>
    Tested-by: Michael Weghorn <m.wegh...@posteo.de>

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;

Reply via email to