In #cleanUpLobbyForChildrenOfView...
- clean up only children of the same device.
- clean up descendents (grand...children), too.
--- a/DeviceGraphicsContext.st Mon Dec 12 11:10:33 2005 +0100
+++ b/DeviceGraphicsContext.st Tue Dec 13 20:07:31 2005 +0100
@@ -136,15 +136,28 @@
!DeviceGraphicsContext class methodsFor:'cleanup'!
-cleanupLobbyForChildrenOfViewWithId:anId
- Lobby
- unregisterAllForWhichHandle:[:handle |
+cleanupLobbyForChildrenOfViewWithDevice:aDevice id:anId
+ "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.
+ Lobby unregisterAllForWhichHandle:[:handle |
|parentId|
- handle notNil
- and:[
- (parentId := handle parentId) notNil
- and:[ parentId address = anId address]]]
+ (handle notNil
+ and:[handle device == aDevice
+ and:[(parentId := handle parentId) notNil
+ and:[parents includes:parentId]]]
+ ) ifTrue:[newChildren add:handle id. true] ifFalse:[false]
+ ].
+ parents := newChildren.
+ ] doWhile:[parents notEmpty].
!
lowSpaceCleanup
@@ -3876,7 +3889,7 @@
!DeviceGraphicsContext class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.106 2005-12-12 10:06:36 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.107 2005-12-13 19:07:30 stefan Exp $'
! !
DeviceGraphicsContext initialize!
--- a/DeviceHandle.st Mon Dec 12 11:10:33 2005 +0100
+++ b/DeviceHandle.st Tue Dec 13 20:07:31 2005 +0100
@@ -56,6 +56,10 @@
!DeviceHandle methodsFor:'accessing'!
+device
+ ^ device
+!
+
id
"return the id of the dravable"
@@ -102,5 +106,5 @@
!DeviceHandle class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/DeviceHandle.st,v 1.13 2005-12-12 10:05:53 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/DeviceHandle.st,v 1.14 2005-12-13 19:07:31 stefan Exp $'
! !
--- a/DisplaySurface.st Mon Dec 12 11:10:33 2005 +0100
+++ b/DisplaySurface.st Tue Dec 13 20:07:31 2005 +0100
@@ -2444,41 +2444,41 @@
|id|
drawableId notNil ifTrue:[
- [
- (device viewIdKnown:drawableId) ifTrue:[
+ [
+ (device viewIdKnown:drawableId) ifTrue:[
"/ 'Display [info]: recycled view (' infoPrint. v infoPrint. ') not destroyed: ' infoPrint.
"/ drawableId displayString infoPrintCR.
- drawableId := nil.
- ] ifFalse:[
- (id := gcId) notNil ifTrue:[
- gcId := nil.
- device deviceIOErrorSignal handle:[:ex |
- ] do:[
- device destroyGC:id.
- ]
- ].
-
- "/ care for lost-view trouble:
- "/ if the windowID is still registered,
- "/ this may be due to a not-yet-reclaimed
- "/ subview of a view which has already been destroyed
- "/ (X recycles window handles.)
- "/ In this case, we arrive here with a nil-view argument,
- "/ and a windowId, which is already reused for some other view.
- "/ The situation is detected by finding a non-nil (and non-zero)
- "/ view in the devices id<->view table for the given windowId.
+ drawableId := nil.
+ ] ifFalse:[
+ (id := gcId) notNil ifTrue:[
+ gcId := nil.
+ device deviceIOErrorSignal handle:[:ex |
+ ] do:[
+ device destroyGC:id.
+ ]
+ ].
+
+ "/ care for lost-view trouble:
+ "/ if the windowID is still registered,
+ "/ this may be due to a not-yet-reclaimed
+ "/ subview of a view which has already been destroyed
+ "/ (X recycles window handles.)
+ "/ In this case, we arrive here with a nil-view argument,
+ "/ and a windowId, which is already reused for some other view.
+ "/ The situation is detected by finding a non-nil (and non-zero)
+ "/ view in the devices id<->view table for the given windowId.
"/ 'GC destroy: ' print. drawableId displayString printCR.
"/ device checkKnownViewId:drawableId.
- id := drawableId.
- drawableId := nil.
- device deviceIOErrorSignal handle:[:ex |
- ] do:[
- device destroyView:nil withId:id.
- ].
- DeviceGraphicsContext cleanupLobbyForChildrenOfViewWithId:id.
- ]
- ] valueUninterruptably.
+ id := drawableId.
+ drawableId := nil.
+ device deviceIOErrorSignal handle:[:ex |
+ ] do:[
+ device destroyView:nil withId:id.
+ ].
+ DeviceGraphicsContext cleanupLobbyForChildrenOfViewWithDevice:device id:id.
+ ]
+ ] valueUninterruptably.
].
"Created: / 25.9.1997 / 10:01:46 / stefan"
@@ -2488,7 +2488,7 @@
!DisplaySurface class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/DisplaySurface.st,v 1.126 2005-12-12 10:10:33 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/DisplaySurface.st,v 1.127 2005-12-13 19:07:29 stefan Exp $'
! !
DisplaySurface initialize!