[squeak-dev] Strange behavior of ContextVariableInspector

Igor Stasenko siguctua at gmail.com
Thu Oct 15 20:02:58 UTC 2009


I suspect this is due to latest updates to debugger & compiler etc,
brought by Eliot.

To display a context variable 'contents', a message #contents is sent
to ContextVariableInspector.
The problem is, that in TextMorphForEditView>>newContents:
which sends this message to model (which is a
ContextVariableInspector) expects that returned value is text, or
string at least.
While at some point, this is not always true, and inspection of
different context slots in debugger could lead to interesting results,
where
#contents returns an actual object, which does not implements #asText
, and as result i often get an
DNU: SmallInteger>>asText
or similar.

The root of evil, i think, is in
ContextVariableInspector>>toggleIndex: method, in following code:

self contentsIsString
	ifTrue: [contents := self selection]
	ifFalse: [contents := self selectionPrintString]].

which sometimes returns an actual object (self selection) instead of
(self selectionPrintString).

I don't really understand, what exactly tests the #contentsIsString method:

contentsIsString
	"Hacked so contents empty when deselected"

	^ #(0 2 3) includes: selectionIndex

maybe a proper fix would be to test additionally, that selection is
string, and if not, then return false, so
caller will use #selectionPrintString later.

-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list