Kaydet (Commit) dabd6add authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Miklos Vajna

Resolves: tdf#93461 captions laid out behind images

regression from...

commit 8a08f686
Author: Mike <mikekaganski@hotmail.com>
Date:   Mon Apr 27 01:27:05 2015 +1000

    tdf#66141: SwTxtFrm::FormatQuick(bool) endless loop

    If a line happens to be invisible (e.g. in too thin cell of a table)
    then aLine.FormatLine(nStart) returns nStart, and
    aLine.Insert( new SwLineLayout() ) is executed until OOM.

keep the zero advance loop detection attempt, but allow the first
insertion and disallow subsequent inserts

Change-Id: I16380588220149cfd0ed0f835f08d2849180fece
(cherry picked from commit f06508e2)
Reviewed-on: https://gerrit.libreoffice.org/18908Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst a47494d5
...@@ -1909,12 +1909,20 @@ bool SwTextFrm::FormatQuick( bool bForceQuickFormat ) ...@@ -1909,12 +1909,20 @@ bool SwTextFrm::FormatQuick( bool bForceQuickFormat )
sal_Int32 nStart = GetOfst(); sal_Int32 nStart = GetOfst();
const sal_Int32 nEnd = GetFollow() const sal_Int32 nEnd = GetFollow()
? GetFollow()->GetOfst() : aInf.GetText().getLength(); ? GetFollow()->GetOfst() : aInf.GetText().getLength();
int nLoopProtection = 0;
do do
{ {
sal_Int32 nShift = aLine.FormatLine(nStart) - nStart; sal_Int32 nNewStart = aLine.FormatLine(nStart);
nStart += nShift; if (nNewStart == nStart)
if ((nShift != 0) // Check for special case: line is invisible, ++nLoopProtection;
// like in too thin table cell: tdf#66141 else
nLoopProtection = 0;
nStart = nNewStart;
const bool bWillEndlessInsert = nLoopProtection > 2;
SAL_WARN_IF(bWillEndlessInsert, "sw", "loop detection triggered");
if ((!bWillEndlessInsert) // Check for special case: line is invisible,
// like in too thin table cell: tdf#66141
&& (aInf.IsNewLine() || (!aInf.IsStop() && nStart < nEnd))) && (aInf.IsNewLine() || (!aInf.IsStop() && nStart < nEnd)))
aLine.Insert( new SwLineLayout() ); aLine.Insert( new SwLineLayout() );
} while( aLine.Next() ); } while( aLine.Next() );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment