diff options
| author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-08-11 14:34:51 +0200 |
|---|---|---|
| committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-08-12 08:34:12 +0200 |
| commit | e081e03342ca8c262403bd9febdc01151a2935be (patch) | |
| tree | 2b9a9f7e257bf4a8188190afc9dfc28f3f5360fe | |
| parent | 82b648edd78ade6051d35657ac8e143946ce1254 (diff) | |
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.grandin@collabora.co.uk>
| -rw-r--r-- | sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
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)); |
