[Newbies] Re: Suspected bug when setting preferences

nicolas cellier ncellier at ifrance.com
Thu Jul 17 20:48:40 UTC 2008


squeak414 at free.fr a écrit :
> The attached test case fails in a new sq3.10.1-7175dev08.06.1 image. (or
> sq3.9.1-7075dev08.07.1.image).
> 
> testPreferenceSaving
> 	PreferenceBrowser new saveSelected.
> 	Smalltalk garbageCollect.
> 	self should: [SystemNavigation default obsoleteBehaviors size = 0]
> 
> SystemNavigation default obsoleteBehaviors inspect actually
> has 400+ entries.
> 
> Most of the entries are BooleanPreferenceView class or PBBooleanPreferenceView
> class, but also other classes such as Scrollbar, UIThemeStandardSqueak, ...
> 
> Am I right in thinking this is incorrect behaviour?
> 
> ...Stan
> 

I tried this in a 3.10 7159 image, inspected one of the 
obsoleteBehaviors and got:

self == PBBooleanPreferenceView.
	"-> false"
PBBooleanPreferenceView. == PBBooleanPreferenceView.
	"-> true"
self class == PBBooleanPreferenceView class.
	"-> true"
self methodDictionary == PBBooleanPreferenceView methodDictionary.
	"-> true"

Seems to be quite a good clone of (Smaaltalk at: #PBBooleanPreferenceView).
Let see if there is any other instance:

self class allInstances size.
	"-> 1"

Hmm, i expected at least 2, self and PBBooleanPreferenceView.

self class allInstances detect: [:e | e == self] ifNone: [].
	"-> nil"
self class allInstances detect: [:e | e == PBBooleanPreferenceView] 
ifNone: [].
	"-> PBBooleanPreferenceView"

Is it class that is lying?
There is a single implementors of class, and it is <primitive 111>...
So what? Is it allInstances that is lying?
Ah yes, Metaclass>>allInstances
	thisClass class == self ifTrue:[^Array with: thisClass].
	^super allInstances
So i cannot get allInstances this way.

| inst next all |
all := OrderedCollection new.
inst := self class someInstance.
[inst == nil]
	whileFalse:
	[
	next := inst nextInstance.
	all add: inst.
	inst := next].
^all

Yes indeed, 168 clones of PBBooleanPreferenceView...
We now have to figure out who created these clones, for what purpose, 
before deciding if it is a bug, but it looks like a bug indeed...

Nicolas



More information about the Beginners mailing list