accessibility/inc/standard/vclxaccessibleedit.hxx    |    1 +
 accessibility/source/standard/vclxaccessiblebox.cxx  |    6 +-----
 accessibility/source/standard/vclxaccessibleedit.cxx |   10 ++++++++++
 3 files changed, 12 insertions(+), 5 deletions(-)

New commits:
commit f81af8f7a5e8f86d4214bc328c44632841fbec2b
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Nov 26 08:41:33 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Nov 26 12:04:14 2024 +0100

    a11y: Handle combobox subedit a11y name in VCLXAccessibleEdit
    
    Let VCLXAccessibleEdit::getAccessibleName take care
    of returning the same accessible name as the combobox
    parent for the combobox subedit instead of trying
    to set the same name when that combobox child is
    requested the first time.
    
    This makes sure the name remains in sync, and prevents
    trying to get the combobox a11y name while a dialog
    containing it might still be in the process of getting
    constructed by VclBuilder, in which case e.g. the
    AccessibleRelation::LABELLED_BY relation that
    gets used in Window::getDefaultAccessibleName
    may not have been set. That relation e.g. gets
    set if a label has the combobox set as its
    "mnemonic-widget" in a .ui file.
    
    The previous logic was triggering an assert
    when opening the "Fonts" page in the "Tools" -> "Options"
    dialog or using the search feature in that dialog on Windows
    with an AT (like NVDA) active when trying to set the a11y
    name of the "font2" combobox's entry
    (UI file: cui/uiconfig/ui/optfontspage.ui):
    
        Assertion failed: GetChildCount() == 4 || pWindowImpl->mbInDispose, 
file .../vcl/source/window/layout.cxx, line 1945
    
    Backtrace:
    
        1   abort                                                               
                                      ucrtbase                           
0x7ffad46e286e
        2   get_wpgmptr                                                         
                                      ucrtbase                           
0x7ffad46e426e
        3   get_wpgmptr                                                         
                                      ucrtbase                           
0x7ffad46e4165
        4   wassert                                                             
                                      ucrtbase                           
0x7ffad46e44f1
        5   VclScrolledWindow::get_child                                        
                                      layout.cxx                    1945 
0x7ffa88f67e35
        6   nextLogicalChildOfParent                                            
                                      dialog.cxx                    139  
0x7ffa88f147cf
        7   nextLogicalChildOfParent                                            
                                      dialog.cxx                    157  
0x7ffa88f14884
        8   nextLogicalChildOfParent                                            
                                      dialog.cxx                    157  
0x7ffa88f14884
        9   ImplGetSubChildWindow                                               
                                      dlgctrl.cxx                   137  
0x7ffa88f197e1
        10  ImplGetChildWindow                                                  
                                      dlgctrl.cxx                   151  
0x7ffa88f18dae
        11  ImplGetNextWindow                                                   
                                      dlgctrl.cxx                   180  
0x7ffa88f19600
        12  ImplFindDlgCtrlWindow                                               
                                      dlgctrl.cxx                   362  
0x7ffa88f18a2b
        13  vcl::ImplGetLabeledBy                                               
                                      legacyaccessibility.cxx       122  
0x7ffa88e65437
        14  vcl::Window::getLegacyNonLayoutAccessibleRelationLabeledBy          
                                      legacyaccessibility.cxx       178  
0x7ffa88e657ac
        15  vcl::Window::GetAccessibleRelationLabeledBy                         
                                      accessibility.cxx             604  
0x7ffa88e6193a
        16  vcl::Window::getDefaultAccessibleName                               
                                      accessibility.cxx             470  
0x7ffa88e63c73
        17  vcl::Window::GetAccessibleName                                      
                                      accessibility.cxx             441  
0x7ffa88e614ba
        18  vcl::Window::SetAccessibleName                                      
                                      accessibility.cxx             427  
0x7ffa88e623bc
        19  VCLXAccessibleBox::getAccessibleChild                               
                                      vclxaccessiblebox.cxx         319  
0x7ffa853e3e02
        20  AccObjectWinManager::InsertChildrenAccObj                           
                                      AccObjectWinManager.cxx       536  
0x7ffa855b2ed1
        21  AccEventListener::HandleChildChangedEvent                           
                                      AccEventListener.cxx          109  
0x7ffa855b9593
        22  AccEventListener::notifyEvent                                       
                                      AccEventListener.cxx          64   
0x7ffa855ba6ef
        23  AccContainerEventListener::notifyEvent                              
                                      AccContainerEventListener.cxx 95   
0x7ffa855bdfbc
        24  comphelper::AccessibleEventNotifier::addEvent                       
                                      accessibleeventnotifier.cxx   256  
0x7ffa916598c0
        25  comphelper::OCommonAccessibleComponent::NotifyAccessibleEvent       
                                      accessiblecomponenthelper.cxx 127  
0x7ffa9165071e
        26  VCLXAccessibleComponent::ProcessWindowChildEvent                    
                                      vclxaccessiblecomponent.cxx   165  
0x7ffa8b7e6029
        27  VCLXAccessibleComponent::WindowChildEventListener                   
                                      vclxaccessiblecomponent.cxx   124  
0x7ffa8b7e6d62
        28  VCLXAccessibleComponent::LinkStubWindowChildEventListener           
                                      vclxaccessiblecomponent.cxx   114  
0x7ffa8b7e5ee6
        29  Link<VclWindowEvent &,void>::Call                                   
                                      link.hxx                      111  
0x7ffa88f3bf43
        30  vcl::Window::CallEventListeners                                     
                                      event.cxx                     300  
0x7ffa88f3c57c
        31  vcl::Window::ImplSetReallyVisible                                   
                                      window.cxx                    1331 
0x7ffa8904394d
        32  vcl::Window::ImplSetReallyVisible                                   
                                      window.cxx                    1344 
0x7ffa89043a1d
        33  vcl::Window::Show                                                   
                                      window.cxx                    2336 
0x7ffa89047671
        34  vcl::Window::Show                                                   
                                      window.cxx                    2349 
0x7ffa8904776e
        35  vcl::Window::set_property                                           
                                      window2.cxx                   1537 
0x7ffa8902d4b3
        36  ComboBox::set_property                                              
                                      combobox.cxx                  1553 
0x7ffa89097521
        37  BuilderUtils::set_properties                                        
                                      builder.cxx                   2192 
0x7ffa88ef13c5
        38  VclBuilder::insertObject                                            
                                      builder.cxx                   2469 
0x7ffa88ee18df
        39  
WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleObject
                  widgetbuilder.hxx             230  0x7ffa88e23d54
        40  
WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleChild
                   widgetbuilder.hxx             127  0x7ffa88e22c30
        41  
WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleObject
                  widgetbuilder.hxx             234  0x7ffa88e23dff
        42  
WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleChild
                   widgetbuilder.hxx             127  0x7ffa88e22c30
        43  
WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleObject
                  widgetbuilder.hxx             234  0x7ffa88e23dff
        44  
WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleChild
                   widgetbuilder.hxx             127  0x7ffa88e22c30
        45  
WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleObject
                  widgetbuilder.hxx             234  0x7ffa88e23dff
        46  
WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleChild
                   widgetbuilder.hxx             127  0x7ffa88e22c30
        47  
WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleObject
                  widgetbuilder.hxx             234  0x7ffa88e23dff
        48  
WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleChild
                   widgetbuilder.hxx             127  0x7ffa88e22c30
        49  
WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::processUIFile
                 widgetbuilder.hxx             70   0x7ffa88e24b4a
        50  VclBuilder::VclBuilder                                              
                                      builder.cxx                   523  
0x7ffa88ea53be
        51  SalInstanceBuilder::SalInstanceBuilder                              
                                      salvtables.cxx                7088 
0x7ffa895da3ff
        52  std::make_unique<SalInstanceBuilder,vcl::Window * &,rtl::OUString 
const &,rtl::OUString const &,0>        memory                        3434 
0x7ffa895d44c8
        53  SalInstance::CreateBuilder                                          
                                      salvtables.cxx                7470 
0x7ffa895ef18e
        54  Application::CreateBuilder                                          
                                      builder.cxx                   198  
0x7ffa88ebed2a
        55  BuilderPage::BuilderPage                                            
                                      weldutils.cxx                 28   
0x7ffa89684128
        56  SfxTabPage::SfxTabPage                                              
                                      tabdlg.cxx                    137  
0x7ffa8cd5f0e5
        57  SvxFontSubstTabPage::SvxFontSubstTabPage                            
                                      fontsubs.cxx                  36   
0x7ffa8372d1cd
        58  std::make_unique<SvxFontSubstTabPage,weld::Container * 
&,weld::DialogController * &,SfxItemSet const &,0> memory                       
 3434 0x7ffa8372cdbf
        59  SvxFontSubstTabPage::Create                                         
                                      fontsubs.cxx                  146  
0x7ffa8372f692
        60  CreateGeneralTabPage                                                
                                      treeopt.cxx                   289  
0x7ffa8383199a
        61  OfaTreeOptionsDialog::SelectHdl_Impl                                
                                      treeopt.cxx                   1317 
0x7ffa838372e7
        62  OfaTreeOptionsDialog::ShowPageHdl_Impl                              
                                      treeopt.cxx                   623  
0x7ffa83837f11
        63  OfaTreeOptionsDialog::LinkStubShowPageHdl_Impl                      
                                      treeopt.cxx                   620  
0x7ffa83834366
        64  Link<weld::TreeView &,void>::Call                                   
                                      link.hxx                      111  
0x7ffa88ebdf13
        65  weld::TreeView::signal_changed                                      
                                      weld.hxx                      969  
0x7ffa88ef210f
        66  SalInstanceTreeView::SelectHdl                                      
                                      salvtables.cxx                5304 
0x7ffa895f4b39
        67  SalInstanceTreeView::LinkStubSelectHdl                              
                                      salvtables.cxx                5299 
0x7ffa895f38c6
        68  Link<SvTreeListBox *,void>::Call                                    
                                      link.hxx                      111  
0x7ffa88ebe413
        69  SvTreeListBox::SelectHdl                                            
                                      treelistbox.cxx               454  
0x7ffa892ba7a1
        70  SvTreeListBox::Select                                               
                                      treelistbox.cxx               2128 
0x7ffa892ba514
        71  SvImpLBox::SetCursor                                                
                                      svimpbox.cxx                  617  
0x7ffa892d05e8
        72  ImpLBSelEng::SetCursorAtPoint                                       
                                      svimpbox.cxx                  2596 
0x7ffa892d08a9
        73  SelectionEngine::SelMouseButtonDown                                 
                                      seleng.cxx                    174  
0x7ffa88fd0071
        74  SvImpLBox::MouseButtonDown                                          
                                      svimpbox.cxx                  2016 
0x7ffa892cc580
        75  SvTreeListBox::MouseButtonDown                                      
                                      treelistbox.cxx               2277 
0x7ffa892b71e2
        76  ImplHandleMouseEvent                                                
                                      winproc.cxx                   708  
0x7ffa89059867
        77  ImplHandleSalMouseButtonDown                                        
                                      winproc.cxx                   2338 
0x7ffa8905afef
        78  ImplWindowFrameProc                                                 
                                      winproc.cxx                   2683 
0x7ffa8905ca47
        79  SalFrame::CallCallback                                              
                                      salframe.hxx                  312  
0x7ffa88e1ee56
        80  ImplHandleMouseMsg                                                  
                                      salframe.cxx                  3335 
0x7ffa85c270bf
        81  SalFrameWndProc                                                     
                                      salframe.cxx                  5987 
0x7ffa85c2de7d
        82  SalFrameWndProcW                                                    
                                      salframe.cxx                  6342 
0x7ffa85c2ec60
        83  CallWindowProcW                                                     
                                      USER32                             
0x7ffad61cef5c
        84  DispatchMessageW                                                    
                                      USER32                             
0x7ffad61ce684
        85  ImplSalDispatchMessage                                              
                                      salinst.cxx                   475  
0x7ffa85b8cf98
        86  ImplSalYield                                                        
                                      salinst.cxx                   552  
0x7ffa85b8d6bd
        87  WinSalInstance::DoYield                                             
                                      salinst.cxx                   581  
0x7ffa85b8cc61
        88  ImplYield                                                           
                                      svapp.cxx                     385  
0x7ffa89656364
        89  Application::Yield                                                  
                                      svapp.cxx                     474  
0x7ffa89659fe2
        90  Dialog::Execute                                                     
                                      dialog.cxx                    1077 
0x7ffa88f0c017
        91  SalInstanceDialog::run                                              
                                      salvtables.cxx                1882 
0x7ffa896149af
        92  weld::DialogController::run                                         
                                      weld.hxx                      2691 
0x7ffa88eef436
        93  OfaTreeOptionsDialog::run                                           
                                      treeopt.cxx                   2514 
0x7ffa83841dd2
        94  CuiAbstractController_Impl::Execute                                 
                                      dlgfact.cxx                   144  
0x7ffa837085c8
        95  SfxApplication::OfaExec_Impl                                        
                                      appserv.cxx                   1641 
0x7ffa8cb36506
        96  SfxStubSfxApplicationOfaExec_Impl                                   
                                      sfxslots.hxx                  1307 
0x7ffa8cb10165
        97  SfxDispatcher::Call_Impl                                            
                                      dispatch.cxx                  257  
0x7ffa8cc1f4ae
        98  SfxDispatcher::Execute_                                             
                                      dispatch.cxx                  754  
0x7ffa8cc2260f
        99  SfxBindings::Execute_Impl                                           
                                      bindings.cxx                  1062 
0x7ffa8cc0086d
        100 SfxDispatchController_Impl::dispatch                                
                                      unoctitm.cxx                  736  
0x7ffa8cc93caa
        101 SfxOfficeDispatch::dispatch                                         
                                      unoctitm.cxx                  254  
0x7ffa8cc945b0
        102 framework::MenuBarManager::Select                                   
                                      menubarmanager.cxx            821  
0x7ffa8d8574d4
        103 framework::MenuBarManager::LinkStubSelect                           
                                      menubarmanager.cxx            776  
0x7ffa8d855796
        104 Link<Menu *,bool>::Call                                             
                                      link.hxx                      111  
0x7ffa88f77d88
        105 Menu::Select                                                        
                                      menu.cxx                      360  
0x7ffa88f83e19
        106 Menu::ImplCallSelect                                                
                                      menu.cxx                      2152 
0x7ffa88f7c761
        107 Menu::LinkStubImplCallSelect                                        
                                      menu.cxx                      2148 
0x7ffa88f82366
        108 Link<void *,void>::Call                                             
                                      link.hxx                      111  
0x7ffa890529b3
        109 ImplHandleUserEvent                                                 
                                      winproc.cxx                   2288 
0x7ffa8905ba97
        110 ImplWindowFrameProc                                                 
                                      winproc.cxx                   2850 
0x7ffa8905d256
        111 SalFrame::CallCallback                                              
                                      salframe.hxx                  312  
0x7ffa88e1ee56
        112 ImplHandleUserEvent                                                 
                                      salframe.cxx                  4471 
0x7ffa85c28fab
        113 SalFrameWndProc                                                     
                                      salframe.cxx                  6236 
0x7ffa85c2e654
        114 SalFrameWndProcW                                                    
                                      salframe.cxx                  6342 
0x7ffa85c2ec60
        115 CallWindowProcW                                                     
                                      USER32                             
0x7ffad61cef5c
        116 DispatchMessageW                                                    
                                      USER32                             
0x7ffad61ce684
        117 ImplSalDispatchMessage                                              
                                      salinst.cxx                   475  
0x7ffa85b8cf98
        118 ImplSalYield                                                        
                                      salinst.cxx                   506  
0x7ffa85b8d09b
        119 WinSalInstance::DoYield                                             
                                      salinst.cxx                   581  
0x7ffa85b8cc61
        120 ImplYield                                                           
                                      svapp.cxx                     385  
0x7ffa89656364
        121 Application::Yield                                                  
                                      svapp.cxx                     474  
0x7ffa89659fe2
        122 Application::Execute                                                
                                      svapp.cxx                     361  
0x7ffa89653aa6
        123 desktop::Desktop::Main                                              
                                      app.cxx                       1679 
0x7ffa9336887f
        124 ImplSVMain                                                          
                                      svmain.cxx                    228  
0x7ffa8966b310
        125 SVMain                                                              
                                      svmain.cxx                    247  
0x7ffa8966baf2
        126 soffice_main                                                        
                                      sofficemain.cxx               121  
0x7ffa933b86f4
        127 sal_main                                                            
                                      main.c                        51   
0x7ff64a491013
        128 main                                                                
                                      main.c                        49   
0x7ff64a49105a
        129 __scrt_common_main_seh                                              
                                      exe_common.inl                288  
0x7ff64a491344
        130 BaseThreadInitThunk                                                 
                                      KERNEL32                           
0x7ffad5c07374
        131 RtlUserThreadStart                                                  
                                      ntdll                              
0x7ffad679cc91
    
    Change-Id: I3be8a8e4acd1c87fdfa495c755fd947e9a11b9aa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177314
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/accessibility/inc/standard/vclxaccessibleedit.hxx 
b/accessibility/inc/standard/vclxaccessibleedit.hxx
index 107ff01f54de..e5d810ccc016 100644
--- a/accessibility/inc/standard/vclxaccessibleedit.hxx
+++ b/accessibility/inc/standard/vclxaccessibleedit.hxx
@@ -63,6 +63,7 @@ public:
     // XAccessibleContext
     virtual sal_Int64 SAL_CALL getAccessibleChildCount(  ) override;
     virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL 
getAccessibleChild( sal_Int64 i ) override;
+    virtual OUString SAL_CALL getAccessibleName() override;
     virtual sal_Int16 SAL_CALL getAccessibleRole(  ) override;
 
     // XAccessibleAction
diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx 
b/accessibility/source/standard/vclxaccessiblebox.cxx
index cee19613a396..9e8569ce0826 100644
--- a/accessibility/source/standard/vclxaccessiblebox.cxx
+++ b/accessibility/source/standard/vclxaccessiblebox.cxx
@@ -313,12 +313,8 @@ Reference<XAccessible> SAL_CALL 
VCLXAccessibleBox::getAccessibleChild (sal_Int64
                 if (m_aBoxType==COMBOBOX)
                 {
                     VclPtr< ComboBox > pComboBox = GetAs< ComboBox >();
-                    if (pComboBox!=nullptr && pComboBox->GetSubEdit()!=nullptr)
-                    //Set the edit's acc name the same as parent
-                    {
-                        
pComboBox->GetSubEdit()->SetAccessibleName(getAccessibleName());
+                    if (pComboBox && pComboBox->GetSubEdit())
                         m_xText = pComboBox->GetSubEdit()->GetAccessible();
-                    }
                 }
                 else if (m_bIsDropDownBox)
                     m_xText = new VCLXAccessibleTextField 
(GetVCLXWindow(),this);
diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx 
b/accessibility/source/standard/vclxaccessibleedit.cxx
index bc528a5c2690..73298a4ff255 100644
--- a/accessibility/source/standard/vclxaccessibleedit.cxx
+++ b/accessibility/source/standard/vclxaccessibleedit.cxx
@@ -202,6 +202,16 @@ Reference< XAccessible > 
VCLXAccessibleEdit::getAccessibleChild( sal_Int64 )
     throw IndexOutOfBoundsException();
 }
 
+OUString VCLXAccessibleEdit::getAccessibleName()
+{
+    OExternalLockGuard aGuard(this);
+
+    // for combobox edit, return name of the parent
+    if (isComboBoxChild())
+        return 
getAccessibleParent()->getAccessibleContext()->getAccessibleName();
+
+    return VCLXAccessibleTextComponent::getAccessibleName();
+}
 
 sal_Int16 VCLXAccessibleEdit::getAccessibleRole(  )
 {

Reply via email to