class: Tools::ViewTreeInspectorApplication
updateChildren: doe it without going deep into recursion
--- a/Tools__ViewTreeApplication.st Thu Mar 26 11:20:01 2015 +0100
+++ b/Tools__ViewTreeApplication.st Mon May 04 16:41:15 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 2007 by eXept Software AG
All Rights Reserved
@@ -2900,18 +2902,29 @@
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'operations update'!
updateChildren
- |list|
-
- self do:[:el|
- el exists ifTrue:[
- el updateChildren.
- ] ifFalse:[
- list isNil ifTrue:[list := OrderedCollection new].
- list add:el.
- ]
- ].
- list notNil ifTrue:[
- list do:[:el| self remove:el ].
+ |queue|
+
+ queue := OrderedCollection new.
+ queue add:self.
+
+ self criticalDo:[
+ [queue notEmpty] whileTrue:[
+ |toRemove elProcessed|
+
+ elProcessed := queue removeFirst.
+ toRemove := nil.
+ elProcessed nonCriticalDo:[:el|
+ el exists ifTrue:[
+ queue add:el.
+ ] ifFalse:[
+ toRemove isNil ifTrue:[toRemove := OrderedCollection new].
+ toRemove add:el.
+ ]
+ ].
+ toRemove notNil ifTrue:[
+ toRemove do:[:el| self remove:el ].
+ ].
+ ].
].
!