View.st
changeset 86 032006651226
parent 83 597bdb33e832
child 87 b64ce99ebeaa
--- a/View.st	Wed Nov 23 00:09:18 1994 +0100
+++ b/View.st	Mon Nov 28 22:01:57 1994 +0100
@@ -44,7 +44,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/View.st,v 1.23 1994-11-22 14:30:47 claus Exp $
+$Header: /cvs/stx/stx/libview/View.st,v 1.24 1994-11-28 21:01:05 claus Exp $
 '!
 
 "this flag controls (globally) how views look - it will vanish"
@@ -69,7 +69,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/View.st,v 1.23 1994-11-22 14:30:47 claus Exp $
+$Header: /cvs/stx/stx/libview/View.st,v 1.24 1994-11-28 21:01:05 claus Exp $
 "
 !
 
@@ -2918,6 +2918,7 @@
     "rerealize at old position"
 
     drawableId notNil ifTrue:[
+	realized := true.
 	subViews notNil ifTrue:[
 	    subViews do:[:aView |
 		aView realize
@@ -3024,7 +3025,15 @@
      This makes any interaction with the current window impossible - 
      however, other views (in their groups) still work."
 
-    (Processor activePriority >= Processor userInterruptPriority) ifFalse:[
+    |active|
+
+    active := Processor activeProcess.
+    (ProcessorScheduler isPureEventDriven 
+    or:[(active priority >= Processor userInterruptPriority)
+    or:[active id == 0
+    or:[active nameOrId endsWith:'dispatcher']]]) ifTrue:[
+	self realize
+    ] ifFalse:[
 	"
 	 create a new window group and put myself into it
 	"
@@ -3045,8 +3054,6 @@
 "/        ]) ifTrue:[
 "/            self hide
 "/        ].
-    ] ifTrue:[
-	self realize
     ]
 !
 
@@ -3464,7 +3471,7 @@
     self redrawX:lx y:ly width:lw height:lh
 ! !
 
-!View methodsFor:'events'!
+!View methodsFor:'event handling'!
 
 destroyed
     "view has been destroyed by someone else (usually window system)"
@@ -3678,13 +3685,29 @@
     "the view has been mapped (by some outside
      action - i.e. window manager de-iconified me)"
 
-    realized := true.
-    shown := true.
-    "backed views will not get expose events - have
-     to force a redraw here to get things drawn into
-     backing store"
-    backed ifTrue:[
-	self redraw
+    "
+     the old code was:
+
+	realized := true.
+	shown := true.
+	...
+
+     this created a race condition, if the view was
+     realized and shortly after unrealized - before the mapped event
+     arrived. This lead to shown being set to true even thought the
+     view was not. Boy - that was a bad one (hard to reproduce and hard to find).
+    "
+
+    realized ifTrue:[
+	shown := true.
+	"
+	 backed views will not get expose events - have
+	 to force a redraw here to get things drawn into
+	 backing store.
+	"
+	backed ifTrue:[
+	    self redraw
+	]
     ]
 !