lotuswordpro/qa/cppunit/data/pass/ofz57800-1.lwp |binary
 lotuswordpro/source/filter/lwplayout.cxx         |    7 +++----
 2 files changed, 3 insertions(+), 4 deletions(-)

New commits:
commit ffdee63185d910f9c239ddf1686f72589eee0973
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Apr 9 19:30:56 2023 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Apr 10 10:40:01 2023 +0200

    ofz#57800 Timeout
    
    Change-Id: I14b4906ce61b3d8a86cb9a766986c49e0b0e6abc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150171
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/lotuswordpro/qa/cppunit/data/pass/ofz57800-1.lwp 
b/lotuswordpro/qa/cppunit/data/pass/ofz57800-1.lwp
new file mode 100644
index 000000000000..3d9b4299f8e1
Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/pass/ofz57800-1.lwp 
differ
diff --git a/lotuswordpro/source/filter/lwplayout.cxx 
b/lotuswordpro/source/filter/lwplayout.cxx
index 4de86299e369..895137e282f2 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -370,7 +370,7 @@ bool LwpVirtualLayout::IsStyleLayout()
 LwpVirtualLayout* LwpVirtualLayout::FindChildByType(LWP_LAYOUT_TYPE eType)
 {
     LwpObjectID* pID = &GetChildHead();
-    LwpVirtualLayout* pPrevLayout = nullptr;
+    o3tl::sorted_vector<LwpVirtualLayout*> aSeen;
 
     while (pID && !pID->IsNull())
     {
@@ -378,14 +378,13 @@ LwpVirtualLayout* 
LwpVirtualLayout::FindChildByType(LWP_LAYOUT_TYPE eType)
         if (!pLayout)
             break;
 
-        if (pPrevLayout && pLayout == pPrevLayout)
+        bool bAlreadySeen = !aSeen.insert(pLayout).second;
+        if (bAlreadySeen)
         {
             SAL_WARN("lwp", "loop in layout");
             break;
         }
 
-        pPrevLayout = pLayout;
-
         if (pLayout->GetLayoutType() == eType)
             return pLayout;
 

Reply via email to