X11-deviceHandle fix:
authorClaus Gittinger <cg@exept.de>
Mon, 12 Dec 2005 11:10:33 +0100
changeset 4435 3704585b9706
parent 4434 cbbb56b8d851
child 4436 05eadeb4b603
X11-deviceHandle fix: unregister all child-handles, when a view-handle gets finalized (because the X11 server internally invalidates and reuses those handles)
DisplaySurface.st
--- a/DisplaySurface.st	Mon Dec 12 11:06:36 2005 +0100
+++ b/DisplaySurface.st	Mon Dec 12 11:10:33 2005 +0100
@@ -2146,9 +2146,11 @@
 destroyView
     "physically destroy the view."
      
-    drawableId notNil ifTrue:[
-	device destroyView:self withId:drawableId.
+    |id|
+
+    (id := drawableId) notNil ifTrue:[
 	drawableId := nil.
+	device destroyView:self withId:id.
 	realized := false.
     ].
 !
@@ -2156,9 +2158,11 @@
 destroyed
     "view has been destroyed by someone else"
 
-    drawableId notNil ifTrue:[
-	device removeKnownView:self withId:drawableId.
+    |id|
+
+    (id := drawableId) notNil ifTrue:[
 	drawableId := nil.
+	device removeKnownView:self withId:id.
 	realized := false. 
     ].
     self destroy
@@ -2440,40 +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.
-                ]
-            ]
-        ] valueUninterruptably.
+		id := drawableId.
+		drawableId := nil.
+		device deviceIOErrorSignal handle:[:ex |
+		] do:[
+		    device destroyView:nil withId:id.
+		].
+		DeviceGraphicsContext cleanupLobbyForChildrenOfViewWithId:id.
+	    ]
+	] valueUninterruptably.
     ].
 
     "Created: / 25.9.1997 / 10:01:46 / stefan"
@@ -2483,7 +2488,7 @@
 !DisplaySurface class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/DisplaySurface.st,v 1.125 2005-07-26 08:51:26 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/DisplaySurface.st,v 1.126 2005-12-12 10:10:33 cg Exp $'
 ! !
 
 DisplaySurface initialize!