AbstractHierarchicalItem.st
changeset 5994 d209971809a4
parent 5993 89860b44c8ef
child 5996 e89a322b31da
--- a/AbstractHierarchicalItem.st	Sun Feb 03 19:33:25 2019 +0100
+++ b/AbstractHierarchicalItem.st	Wed Feb 06 16:01:06 2019 +0100
@@ -237,11 +237,11 @@
 
     self synchronized:[
         self removeAll.
-        self addAll:aListOfChildren beforeIndex:1
+        self addAll:aListOfChildren beforeIndex:1.
     ].
     ^ aListOfChildren
 
-    "Modified: / 28-07-2018 / 15:47:25 / Claus Gittinger"
+    "Modified: / 06-02-2019 / 15:59:15 / Claus Gittinger"
 !
 
 first
@@ -852,18 +852,18 @@
      Not synchronized - should only be called internally
      within a synchronized region."
 
-    |coll model notify index size|
-
-    size := children size.
+    |coll model notify index oldSize|
+
+    oldSize := children size.
 
     anIndex == 1 ifTrue:[
         notify := self
     ] ifFalse:[
-        anIndex > size ifTrue:[
-            anIndex > (1 + size) ifTrue:[
+        anIndex > oldSize ifTrue:[
+            anIndex > (1 + oldSize) ifTrue:[
                 ^ self subscriptBoundsError:index
             ].
-            notify := self at:size
+            notify := self at:oldSize
         ] ifFalse:[
             notify := nil
         ]
@@ -871,7 +871,7 @@
 
     aList do:[:eachItem| eachItem parent:self ].
 
-    size == 0 ifTrue:[
+    oldSize == 0 ifTrue:[
         self setChildren:(OrderedCollection withAll:aList).
     ] ifFalse:[
         children isArray ifTrue:[
@@ -913,6 +913,7 @@
     "Modified: / 01-08-2018 / 15:31:54 / Stefan Vogel"
     "Modified (format): / 02-08-2018 / 15:52:16 / Stefan Vogel"
     "Modified: / 03-02-2019 / 19:32:25 / Claus Gittinger"
+    "Modified (format): / 06-02-2019 / 15:58:41 / Claus Gittinger"
 !
 
 basicRemoveFromIndex:startIndex toIndex:stopIndex
@@ -1425,9 +1426,16 @@
 !
 
 setChildren:aCollectionOfChildrenOrNil
-    children := aCollectionOfChildrenOrNil
+    children := aCollectionOfChildrenOrNil.
+    
+    Smalltalk isSmalltalkDevelopmentSystem ifTrue:[
+        children notNil ifTrue:[
+            self assert:(children conform:[:each | each parent == self]).
+        ].
+    ].
 
     "Created: / 03-02-2019 / 19:22:26 / Claus Gittinger"
+    "Modified: / 06-02-2019 / 16:00:51 / Claus Gittinger"
 !
 
 synchronized:aBlock