vcl/osx/a11yselectionwrapper.mm |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit ca060dac4beb944ac6994ba9c050ab4eba4fc44e
Author:     Patrick Luby <plub...@neooffice.org>
AuthorDate: Sun Jun 11 07:04:16 2023 -0400
Commit:     Patrick Luby <plub...@neooffice.org>
CommitDate: Mon Jun 12 02:02:11 2023 +0200

    Fix hanging when selecting a column or row in Calc
    
    When a Calc column is selected, the child count will be
    at least a million. Constructing that many C++ Calc objects
    takes several minutes even on a fast Silicon Mac so apply
    the maximum table cell limit here.
    
    Change-Id: I4e3ebf9fdf7367620313e4e10dd0918de9d6bffb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152853
    Tested-by: Jenkins
    Reviewed-by: Patrick Luby <plub...@neooffice.org>

diff --git a/vcl/osx/a11yselectionwrapper.mm b/vcl/osx/a11yselectionwrapper.mm
index dfddce4b3b79..9d3beee2d3aa 100644
--- a/vcl/osx/a11yselectionwrapper.mm
+++ b/vcl/osx/a11yselectionwrapper.mm
@@ -22,6 +22,7 @@
 #include <osx/a11yfactory.h>
 
 #include "a11yselectionwrapper.h"
+#include "a11ytablewrapper.h"
 
 using namespace ::com::sun::star::accessibility;
 using namespace ::com::sun::star::uno;
@@ -36,6 +37,17 @@ using namespace ::com::sun::star::uno;
         NSMutableArray * children = [ [ NSMutableArray alloc ] init ];
         try {
             sal_Int64 n = xAccessibleSelection -> 
getSelectedAccessibleChildCount();
+
+            // Fix hanging when selecting a column or row in Calc
+            // When a Calc column is selected, the child count will be
+            // at least a million. Constructing that many C++ Calc objects
+            // takes several minutes even on a fast Silicon Mac so apply
+            // the maximum table cell limit here.
+            if ( n < 0 )
+                n = 0;
+            else if ( n > MAXIMUM_ACCESSIBLE_TABLE_CELLS )
+                n = MAXIMUM_ACCESSIBLE_TABLE_CELLS;
+
             for ( sal_Int64 i=0 ; i < n ; ++i ) {
                 [ children addObject: [ AquaA11yFactory wrapperForAccessible: 
xAccessibleSelection -> getSelectedAccessibleChild( i ) ] ];
             }

Reply via email to