sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit e081e03342ca8c262403bd9febdc01151a2935be
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Sun Aug 11 14:34:51 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Aug 12 08:34:12 2024 +0200

    prevent accessibility check from locking up the UI
    
    there is probably a better approach, and there should be a UI warning
    that the list is truncated
    
    Change-Id: I6df11b16fee3ac6da38e47ac11b1cd0b29e2959d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171725
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx 
b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
index e71389801660..593d2ec127fe 100644
--- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
+++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
@@ -235,6 +235,12 @@ void 
A11yCheckIssuesPanel::addEntryForGroup(AccessibilityCheckGroups eGroup,
                                             
std::shared_ptr<sfx::AccessibilityIssue> const& pIssue)
 {
     auto nGroupIndex = size_t(eGroup);
+    // prevent the UI locking up forever, this is effectively an O(n^2) 
situation, given the way the UI additions work
+    if (m_aEntries[nGroupIndex].size() > 500)
+    {
+        SAL_WARN("sw", "too many a11y issues, not adding to panel");
+        return;
+    }
     auto xEntry = 
std::make_unique<AccessibilityCheckEntry>(m_xBoxes[nGroupIndex].get(), pIssue);
     m_xBoxes[nGroupIndex]->reorder_child(xEntry->get_widget(), 
rIndices[nGroupIndex]++);
     m_aEntries[nGroupIndex].push_back(std::move(xEntry));

Reply via email to