[squeak-dev] The Trunk: Morphic-tonyg.1687.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Oct 8 09:05:42 UTC 2020


Tony Garnock-Jones uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-tonyg.1687.mcz

==================== Summary ====================

Name: Morphic-tonyg.1687
Author: tonyg
Time: 8 October 2020, 11:05:35.50804 am
UUID: 5f80a2cc-df45-4cd3-b083-cbe3daff637b
Ancestors: Morphic-eem.1686

Repair an error in Halo click handling that manifests with multiple transient hands.

Without this fix, you get an infinite recursion if:
	1. a Hand ('X') opens a halo on a Morph
	2. X disappears from the World
	3. a different Hand ('Y') clicks on the Morph associated with the Halo
	
The reason for the infinite recursion is that the code before this change assumes that "event hand halo", Y's halo, is the halo in question, but that is not true because X, the hand "holding" the halo, already left the world.

The change here makes Y, "event hand", adopt the halo before considering whether to discard the halo or not, so when it comes time, "event hand removeHalo" will do the right thing.

=============== Diff against Morphic-eem.1686 ===============

Item was changed:
  ----- Method: SimpleHaloMorph>>mouseDown: (in category 'events') -----
  mouseDown: event
  	"Transfer the halo to the next likely recipient"
  
+ 	event hand obtainHalo: self.
+ 
  	((self containsPoint: event position) not or: [event blueButtonPressed not])
  		ifTrue: [
  			"Close this halo and give another morph the chance to react."
  			event hand removeHalo.
  			event resetHandlerFields.
  			event hand world processEvent: event.
  			^ self].
  
+ 	self target ifNil: [
+ 		event hand removeHalo.
+ 		^self].
- 	self target ifNil: [^self delete].
- 	event hand obtainHalo: self.
  
  	self positionOffset: (event position - (self target point: self target position in: self owner)).
  
  	"wait for drags or transfer"
  	event hand 
  		waitForClicksOrDrag: self 
  		event: event
  		selectors: { #transferHalo:. nil. nil. #startDragTarget:. }
  		threshold: HandMorph dragThreshold.!



More information about the Squeak-dev mailing list