[squeak-dev] The Trunk: Morphic-LM.1678.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Sep 3 11:11:36 UTC 2020


Fabio Niephaus uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-LM.1678.mcz

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

Name: Morphic-LM.1678
Author: LM
Time: 3 September 2020, 12:58:35.620287 pm
UUID: d1262531-fd1c-43a1-ba41-9ff8b3728a3a
Ancestors: Morphic-ct.1677

Prevent users from creating multiple SystemProgressMorphs by abusing uniqueInstance.

Currently the UniqueInstance class variable is not set properly when it is nil, which allows the user to call it multiple times to generate many SystemProgressMorphs, defeating the purpose of having a *unique* instance.

=============== Diff against Morphic-mt.1674 ===============

Item was changed:
  ----- Method: MenuItemMorph>>invokeWithEvent: (in category 'events') -----
  invokeWithEvent: evt
  	"Perform the action associated with the given menu item."
  
- 	| w |
  	self isEnabled ifFalse: [^ self].
+ 	
+ 	(owner notNil and: [self isStayUpItem not]) ifTrue: [
- 	target class == HandMorph ifTrue: [(self notObsolete) ifFalse: [^ self]].
- 	owner ifNotNil:[self isStayUpItem ifFalse:[
  		self flag: #workAround. "The tile system invokes menus straightforwardly so the menu might not be in the world."
+ 		self world ifNotNil: [:world |
- 		(w := self world) ifNotNil:[
  			owner deleteIfPopUp: evt.
  			"Repair damage before invoking the action for better feedback"
+ 			world displayWorldSafely]].
+ 	
+ 	selector ifNil: [^ self].
+ 	
+ 	Cursor normal showWhile: [
+ 		"show cursor in case item opens a new MVC window"
+ 		selector numArgs isZero
+ 				ifTrue: [target perform: selector]
+ 				ifFalse: [target perform: selector withArguments: (
+ 					selector numArgs = arguments size
+ 						ifTrue: [arguments]
+ 						ifFalse: [arguments copyWith: evt] )] ].!
- 			w displayWorldSafely]]].
- 	selector ifNil:[^self].
- 	Cursor normal showWhile: [ | selArgCount |  "show cursor in case item opens a new MVC window"
- 		(selArgCount := selector numArgs) = 0
- 			ifTrue:
- 				[target perform: selector]
- 			ifFalse:
- 				[selArgCount = arguments size
- 					ifTrue: [target perform: selector withArguments: arguments]
- 					ifFalse: [target perform: selector withArguments: (arguments copyWith: evt)]]].!

Item was removed:
- ----- Method: MenuItemMorph>>notObsolete (in category 'private') -----
- notObsolete
- 	"Provide backward compatibility with messages being sent to the Hand.  Remove this when no projects made prior to 2.9 are likely to be used.  If this method is removed early, the worst that can happen is a notifier when invoking an item in an obsolete menu."
- 
- 	(HandMorph canUnderstand: (selector)) ifTrue: [^ true]. 	"a modern one"
- 
- 	self inform: 'This world menu is obsolete.
- Please dismiss the menu and open a new one.'.
- 	^ false
- !

Item was changed:
  ----- Method: SystemProgressMorph class>>uniqueInstance (in category 'instance creation') -----
  uniqueInstance
+ 
+ 	^ UniqueInstance ifNil: [UniqueInstance := super new]!
- 	^UniqueInstance ifNil:[super new]!



More information about the Squeak-dev mailing list