[squeak-dev] Re: WorldState deferredUIMessages queue

Andreas Raab andreas.raab at gmx.de
Tue Mar 24 21:37:26 UTC 2009


Chris Muller wrote:
> (3.9 Morphic).  With Maui I occassionally get World lockups due to the
> UI process waiting for the #next of the deferredUIMessages, which is
> empty.
> 
> Specifically, the freeze, when it occurs, is always in
> WorldState>>#runStepMethodsIn:.  There's a while loop to process
> messages in the queue:
> 
> 	"Dispatch deferred messages while maintaing rudimentary UI responsiveness."
> 	[i < numItems and: [(Time millisecondsSince: stamp) < limit]]
> 		whileTrue: [queue next value. i := i + 1].

This is plain wrong. I don't know what the rationale of the change was 
but you'll have much better success if you change this to e.g.,

	queue := self class deferredUIMessages.
	[(msg := queue nextOrNil) == nil] whileFalse: [
		msg value.
	].

The reason why the original version is wrong is that there is absolutely 
no assurance that some Morph won't call World doOneCycle which would 
re-enter the above loop, pull out all of the events and leave the 
original caller hanging; just as you report.

Cheers,
   - Andreas



More information about the Squeak-dev mailing list