Igor, take a look back in the messages from January 25th 2010
        Re: [Pharo-project] new mac menu code 
There may be something related there?


On 2010-10-15, at 9:41 PM, Igor Stasenko wrote:

> mouseTrailFrom: currentBuf
>       "Current event, a mouse event buffer, is about to be processed.  If
> there are other similar mouse events queued up, then drop them from
> the queue, and report the positions inbetween."
> 
>       | nextEvent trail |
>       trail := (Array new: 1) writeStream.
>       trail nextPut: currentBuf third @ currentBuf fourth.
> *a*   [(nextEvent := Sensor peekEvent) isNil] whileFalse:
>                       [nextEvent first = currentBuf first
>                               ifFalse: [^trail contents       "different 
> event type"].
>                       nextEvent fifth = currentBuf fifth
>                               ifFalse: [^trail contents       "buttons 
> changed"].
>                       nextEvent sixth = currentBuf sixth
>                               ifFalse: [^trail contents       "modifiers 
> changed"].
>                       "nextEvent is similar.  Remove it from the queue, and 
> check the next."
> *b*                   nextEvent := Sensor nextEvent.
>                       trail nextPut: nextEvent third @ nextEvent fourth].
>       ^trail contents
> 
> 
> Here, the bug:
> first it sends #peekEvent and its not nil.
> Okay, then after some logic voodo, it sends nextEvent, without
> precaution, that it may also answer nil!
> 
> So, if some other process get between these two sends (*a*, *b*) and
> fetch/flush all events, a code will fail,
> because
> 'nextEvent third' is DNU , when nextEvent == nil.
> 
> The fix is simple:
> 
> nextEvent := Sensor nextEvent.
> nextEvent ifNotNil: [ trail nextPut: nextEvent third @ nextEvent fourth]
> 
> Both Pharo & Squeak contain this bug. But this method slightly differs
> from each other.
> 
> -- 
> Best regards,
> Igor Stasenko AKA sig.
> 
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

--
===========================================================================
John M. McIntosh <[email protected]>   Twitter:  squeaker68882
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================




Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to