WindowGroup.st
changeset 4408 308c798612a8
parent 4378 29da8415352c
child 4413 139a64d7cb9a
--- a/WindowGroup.st	Tue Jul 19 16:10:22 2005 +0200
+++ b/WindowGroup.st	Wed Jul 20 10:11:52 2005 +0200
@@ -1331,6 +1331,11 @@
                 ^ self
             ].
 
+            (graphicsDevice notNil and:[graphicsDevice isOpen not]) ifTrue:[
+                self closeDownViews.
+                ^ self.
+            ].
+
             sigs handle:[:ex |
                 |theSig|
 
@@ -1375,7 +1380,18 @@
                     "/ Flush device output before going to sleep. 
                     "/ This may produce more events to arrive.
                     "/ Q: is this still needed (see suspendAction) ?
-                    self graphicsDevice flush.
+                    Error 
+                        handle:[:ex |
+                            (graphicsDevice notNil and:[graphicsDevice isOpen not]) ifTrue:[
+                                'WindowGroup [warning]: Error in flush - closing views' errorPrintCR.
+                                self closeDownViews.
+                                ^ self.
+                            ].
+                            ex reject.
+                        ] 
+                        do:[
+                            self graphicsDevice flush.
+                        ].
                     thisProcess setStateTo:#eventWait if:#active.
 
                     "/ now, wait for an event to arrive
@@ -2667,7 +2683,7 @@
         |cId vId dev|
 
         dev := aView graphicsDevice.
-        dev notNil ifTrue:[
+        (dev notNil and:[dev isOpen]) ifTrue:[
             c := c onDevice:dev.
             (cId := c id) notNil ifTrue:[
                (vId := aView id) notNil ifTrue:[
@@ -2680,7 +2696,6 @@
         ].
     ].
     myDevice flush
-
 !
 
 withCursor:aCursor do:aBlock
@@ -2769,7 +2784,7 @@
 !WindowGroup class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.275 2005-04-14 09:11:54 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.276 2005-07-20 08:11:52 cg Exp $'
 ! !
 
 WindowGroup initialize!