HostGraphicsDevice.st
changeset 7475 3acd8db4f044
parent 7443 e2d05b756727
child 7546 830c4ba33493
--- a/HostGraphicsDevice.st	Tue Jul 26 10:15:22 2016 +0200
+++ b/HostGraphicsDevice.st	Tue Jul 26 15:09:39 2016 +0200
@@ -9,8 +9,6 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
-'From Smalltalk/X, Version:7.1.0.0 on 20-07-2016 at 14:38:04'                   !
-
 "{ Package: 'stx:libview' }"
 
 "{ NameSpace: Smalltalk }"
@@ -207,6 +205,29 @@
 
 !HostGraphicsDevice methodsFor:'registration'!
 
+cleanupLobbyForChildrenOfViewWithId:anId
+    "recursively clean all the subcomponents of the handle with id anId.
+     This must be done on finalization, because descendent handles
+     are destroyed implicitly when a parent handle is destroyed."
+
+    |parents newChildren|
+
+    parents := Array with:anId address.
+
+    [
+        newChildren := Set new.
+        graphicsContexts unregisterAllForWhichHandle:[:handle |
+            |parentId|
+
+            handle notNil
+                and:[(parentId := handle parentId) notNil
+                and:[(parents includes:parentId)
+                and:[newChildren add:handle id. true]]].
+        ].
+        parents := newChildren.
+    ] doWhile:[parents notEmpty].
+!
+
 registerColor:aColor
     deviceColors register:aColor.