diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2023-06-09 13:59:58 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2023-06-09 18:07:19 +0200 |
commit | ca9341cf60f3f9350662d30b61f6eadefca24667 (patch) | |
tree | 1402af117ecf36cb0d24a8b7b7ef455f9e0e640e /sw/source/core/crsr/crsrsh.cxx | |
parent | 364c8676f773085031bf454b810280ecbaf12b6a (diff) |
cool#6580 sw: fix infinite loop when changing document language
If there's a footnote in the document, changing the document langauge
goes into an infinite loop in FindParentText(), because the selection
created by ExtendedSelectAll(true) is actually invalid, apparently
the intention is that only very limited functions may be called while it
is active.
Don't handle this invalid "very" extended selection like one created by
ExtendedSelectAll(false).
(regression from commit d81379db730a163c5ff75d4f3a3cddbd7b5eddda)
Change-Id: Icf1032715cf2e0a05bf485039c483440c08bb6bb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152797
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw/source/core/crsr/crsrsh.cxx')
-rw-r--r-- | sw/source/core/crsr/crsrsh.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 325ff54d52cd..9fb43ff2d596 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -895,6 +895,16 @@ SwCursorShell::ExtendedSelectedAll() const typename SwCursorShell::StartsWith SwCursorShell::StartsWith_() { SwShellCursor const*const pShellCursor = getShellCursor(false); + // first, check if this is invalid; ExtendedSelectAll(true) may result in + // a) an ordinary selection that is valid + // b) a selection that is extended + // c) a selection that is invalid and will cause FindParentText to loop + SwNode const& rEndOfExtras(GetDoc()->GetNodes().GetEndOfExtras()); + if (pShellCursor->Start()->nNode.GetIndex() <= rEndOfExtras.GetIndex() + && rEndOfExtras.GetIndex() < pShellCursor->End()->nNode.GetIndex()) + { + return StartsWith::None; // *very* extended, no ExtendedSelectedAll handling! + } SwStartNode const*const pStartNode(FindParentText(*pShellCursor)); if (auto const ret = ::StartsWith(*pStartNode); ret != StartsWith::None) { |