The Trunk: Tools-ct.1365.mcz
[email protected] Mon, 6 Jul 2026 19:20:27 0000
| Newsgroups | gmane.comp.lang.smalltalk.squeak.general |
|---|---|
| Message-ID | <[email protected]> |
Christoph Thiede uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-ct.1365.mcz
==================== Summary ====================
Name: Tools-ct.1365
Author: ct
Time: 6 July 2026, 9:20:26.875432 pm
UUID: 15700904-6a54-42d8-8614-2d61a8774adb
Ancestors: Tools-ct.1364
Avoids unsafe storeString in truncated inspectors where possible. In the truncation message, makes printed keys clickable instead to provide usable object references. Guards the remaining senders of printString and storeString with exception handlers.
Also replaces three further senders of #inspect with "ToolSet inspect: ..." for proxy support.
Fixes https://github.com/squeak-smalltalk/squeak-object-memory/issues/115. Thanks to Nicolas (nice) for reporting this!
=============== Diff against Tools-ct.1364 ===============
Item was changed:
----- Method: DictionaryInspector>>renameKey (in category 'menu - commands') -----
renameKey
self assertElementSelectedOr: [^ self changed: #flash].
self renameKey: (
self
+ requestKeyInitialAnswer: (self tryStore: self selectedKey)
- requestKeyInitialAnswer: self selectedKey storeString
orCancel: [^ self]).!
Item was changed:
----- Method: DictionaryInspector>>renameKey: (in category 'menu - commands') -----
renameKey: aKey
self assertElementSelectedOr: [^ self changed: #flash].
(self object includesKey: aKey)
ifTrue: [(self confirm: 'The target key exists. Do you want to replace it?' translated)
ifFalse: [^ self]].
self object
at: aKey put: self selection;
removeKey: self selectedKey.
self updateFields.
self selectKey: aKey.
+ self hasSelection ifFalse: [self inform: ('The selected key was renamed to {1}.\\Yet, the list of fields is quite long. The new field got truncated and is thus not visible.' translated withCRs format: {self tryPrint: aKey})].!
- self hasSelection ifFalse: [self inform: ('The selected key was renamed to {1}.\\Yet, the list of fields is quite long. The new field\got truncated and is thus not visible.' translated withCRs format: {aKey printString})].!
Item was changed:
----- Method: Inspector>>contentsForTruncationOf: (in category 'fields - truncation') -----
contentsForTruncationOf: truncatedKeys
^ ((self respondsTo: #showAllFields)
+ ifFalse: ['<Fields {1} to {2} are not shown. {3} to inspect one of those fields or select "inspect element" from the field list menu.>' translated asText]
+ ifTrue: ['<Fields {1} to {2} are not shown. {4} to show all fields, or {5} to inspect one of those fields (also available through "inspect element" from the field list menu).>' translated asText])
- ifFalse: ['<Fields named {1} to {2} are not shown. {3} to inspect one of those fields or select "inspect element" from the field list menu.>' translated asText]
- ifTrue: ['<Fields named {1} to {2} are not shown. {4} to show all fields, or {5} to inspect one of those fields (also available through "inspect element" from the field list menu).>' translated asText])
addAttribute: TextEmphasis italic;
format: {
+ (self tryPrint: truncatedKeys first) asText
+ addAttribute: (TextInspectIt on: truncatedKeys first);
+ yourself.
+ (self tryPrint: truncatedKeys last) asText
+ addAttribute: (TextInspectIt on: truncatedKeys last);
+ yourself.
- truncatedKeys first storeString.
- truncatedKeys last storeString.
'Click here' translated asText
addAttribute: (PluggableTextAttribute evalBlock: [self inspectOneOf: truncatedKeys]);
yourself.
'Click here' translated asText
addAttribute: (PluggableTextAttribute evalBlock: [self showAllFields]);
yourself.
'click here' translated asText
addAttribute: (PluggableTextAttribute evalBlock: [self inspectOneOf: truncatedKeys]);
yourself.}!
Item was changed:
----- Method: Inspector>>inspectOneOf: (in category 'menu - commands') -----
inspectOneOf: someKeys
| elements labels choice |
someKeys size = 0 ifTrue: [^ self inform: 'Nothing to inspect.' translated].
+ someKeys size = 1 ifTrue: [^ ToolSet inspect: (self elementAt: someKeys first)].
- someKeys size = 1 ifTrue: [^ (self elementAt: someKeys first) inspect].
someKeys size > 50 ifTrue: [^ self inspectOneOfFrom: someKeys first to: someKeys last].
elements := someKeys collect: [:key | [self elementAt: key] ifError: ['<???>']].
labels := someKeys with: elements collect: [:key :element |
'{1} -> {2}' format: {
+ self tryPrint: key.
- key printString.
[element printString withoutLineEndings withBlanksCondensed truncateWithEllipsisTo: 75]
ifError: ['<???>']}].
choice := Project uiManager chooseFrom: labels title: 'Inspect which field?' translated.
choice = 0 ifTrue: [^ self].
+ ^ ToolSet inspect: (elements at: choice)!
- (elements at: choice) inspect.!
Item was changed:
----- Method: Inspector>>inspectOneOfFrom:to: (in category 'menu - commands') -----
inspectOneOfFrom: firstKey to: lastKey
"Let the user specify the desired field's key in the form of a Smalltalk literal or otherwise simple code expression."
| choiceString |
choiceString := Project uiManager
request: ('Enter the name of the field to inspect.\Names range from {1} to {2}.' translated withCRs
+ format: {self tryPrint: firstKey. self tryPrint: lastKey})
+ initialAnswer: (self tryStore: firstKey).
- format: {firstKey storeString. lastKey storeString})
- initialAnswer: firstKey storeString.
choiceString isEmptyOrNil ifTrue: [^ self].
+ ^ ToolSet inspect: (self elementAt: (Compiler evaluate: choiceString))!
- (self elementAt: (Compiler evaluate: choiceString)) inspect.!
Item was added:
+ ----- Method: Inspector>>tryPrint: (in category 'private') -----
+ tryPrint: anObject
+
+ ^ [anObject printString]
+ on: Error do: ['<printString error>' translated]!
Item was added:
+ ----- Method: Inspector>>tryStore: (in category 'private') -----
+ tryStore: anObject
+ "storeString is unsafe and might run endless for huge or cyclic data structures"
+
+ ^ [[anObject storeString]
+ valueWithin: 5 seconds onTimeout: [self error: 'storeString timeout']]
+ on: Error do: ['<storeString error>' translated]!
Item was changed:
----- Method: InspectorField>>debugAccessor:with:for: (in category 'menu - commands') -----
debugAccessor: accessor with: aBlock for: anInspector
^ (Process
forBlock: aBlock
runUntil: [:context | context closure == accessor or: [context method == accessor or: [context selector == accessor or: [context selector == #doesNotUnderstand:]]]])
+ debugWithTitle: ('Debug inspector field accessor "{1}" for object "{2}"' translated format: {self name. anInspector tryPrint: anInspector object})!
- debugWithTitle: ('Debug inspector field accessor "{1}" for object "{2}"' translated format: {self name. anInspector object printString})!
Squeak-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]