cleanup scheme fixed
authorca
Wed, 10 Jun 2009 15:27:40 +0200
changeset 5285 6dfae0d329e6
parent 5284 03feaa9943db
child 5286 02454fe2c423
cleanup scheme fixed
WindowGroup.st
--- a/WindowGroup.st	Wed Jun 10 12:54:50 2009 +0200
+++ b/WindowGroup.st	Wed Jun 10 15:27:40 2009 +0200
@@ -862,11 +862,15 @@
     ].
     views := nil.
     topViews := nil.
-    mySensor := nil.
+
+    "/ keep the sensor in case there are pending incoming events;
+    "/ otherwise there is a chance that we end up in a debugger in the
+    "/ device's event handling (wGroup nonNil, but sensor isNil) for
+    "/ the unmappedView and focusOUT events.
+    mySensor flushAllEvents.
+    "/ mySensor := nil.
 
     "Modified: / 6.5.1999 / 09:47:18 / cg"
-
-
 !
 
 modalDialogFinished
@@ -1006,35 +1010,9 @@
         LastActiveGroup := nil.
 
         self realizeTopViews.
-
         self 
             eventLoopWhile:checkBlock 
-            onLeave:[
-                "
-                 cleanup, in case of a terminate
-                "
-                "/ previousGroup := nil.
-                topViews := nil.
-                views := nil.
-                "
-                 the following is rubbish;
-                 the views could be reused ..
-                "
-
-"/                topViews notNil ifTrue:[
-"/                    topViews do:[:aView |
-"/                        aView destroy
-"/                    ].
-"/                    topViews := nil.
-"/                ].
-"/                views notNil ifTrue:[
-"/                    views do:[:aView |
-"/                        aView destroy
-"/                    ].
-"/                    views := nil.
-"/                ].
-
-        ]
+            onLeave:[]
     ].
 
 returnFocus ifTrue:[
@@ -1113,7 +1091,11 @@
                     (dev := self graphicsDevice) notNil ifTrue:[
                         dev deviceIOErrorSignal handle:[:ex |
                         ] do:[
-                            self closeDownViews
+                            "/ just in case the view did not yet have a chance to 
+                            "/ shutDown properly (process killed in processMonitor)
+                            views notNil ifTrue:[
+                                self closeDownViews
+                            ]
                         ]
                     ]
                 ]
@@ -1443,12 +1425,7 @@
                 ]
             ].
         ].
-    ] ensure:[
-        "/
-        "/ perform any cleanupActions
-        "/
-        cleanupActions value
-    ]
+    ] ensure:cleanupActions
 
     "Modified: / 14-12-1995 / 11:12:24 / stefan"
     "Modified: / 29-08-2006 / 14:49:05 / cg"
@@ -2715,7 +2692,7 @@
 !WindowGroup class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.299 2009-06-01 08:43:28 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.300 2009-06-10 13:27:40 ca Exp $'
 ! !
 
 WindowGroup initialize!