40bd91c
From 821ae197db7d28aee0d25a74acbacee0b1b09d7c Mon Sep 17 00:00:00 2001
40bd91c
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
40bd91c
Date: Fri, 22 Nov 2019 10:10:27 +0000
40bd91c
Subject: [PATCH] Resolves: rhbz#1775544 crash in navigator
40bd91c
40bd91c
see demo reproducer in rhbz#1775544 nChildCount is a count of all
40bd91c
descendants not just direct children.
40bd91c
40bd91c
Just looping while FirstChild returns something is sufficient.
40bd91c
40bd91c
Change-Id: If7b16032731d694bfffaae22faad5fe194d1822f
40bd91c
---
40bd91c
 sw/source/uibase/utlui/content.cxx | 8 ++------
40bd91c
 1 file changed, 2 insertions(+), 6 deletions(-)
40bd91c
40bd91c
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
40bd91c
index 468ba6cbfa16..3353bc6350e7 100644
40bd91c
--- a/sw/source/uibase/utlui/content.cxx
40bd91c
+++ b/sw/source/uibase/utlui/content.cxx
40bd91c
@@ -2272,12 +2272,8 @@ bool SwContentTree::HasContentChanged()
40bd91c
                     }
40bd91c
                     if(bRemoveChildren)
40bd91c
                     {
40bd91c
-                        for(size_t j = 0; j < nChildCount; ++j)
40bd91c
-                        {
40bd91c
-                            SvTreeListEntry *const pRemove = FirstChild(pEntry);
40bd91c
-                            assert(pRemove);
40bd91c
-                            GetModel()->Remove(pRemove);
40bd91c
-                        }
40bd91c
+                        while (SvTreeListEntry *const pRemove = FirstChild(pEntry))
40bd91c
+                            RemoveEntry(pRemove);
40bd91c
                     }
40bd91c
                     if(!nChildCount)
40bd91c
                     {
40bd91c
-- 
40bd91c
2.20.1
40bd91c