Suspected bug when setting preferences

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Suspected bug when setting preferences

Stan Shepherd
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


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

TestPreferenceSaving.st (662 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Suspected bug when setting preferences

Nicolas Cellier-3
[hidden email] 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

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Suspected bug when setting preferences

Stan Shepherd

nicolas cellier wrote

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
It happens in
Preferences>>savePersonalPreferences
        "Save the current list of Preference settings as the user's personal choices"

        self  setParameter:#PersonalDictionaryOfPreferences
                 to:self dictionaryOfPreferences deepCopy

I think during the deepCopy.

...Stan
Reply | Threaded
Open this post in threaded view
|

Re: Suspected bug when setting preferences

Nicolas Cellier-3
stan shepherd wrote:

>
>
> nicolas cellier wrote:
>>
>>
>> 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
>>
>>
>
> It happens in
> Preferences>>savePersonalPreferences
> "Save the current list of Preference settings as the user's personal
> choices"
>
> self  setParameter:#PersonalDictionaryOfPreferences
> to:self dictionaryOfPreferences deepCopy
>
> I think during the deepCopy.
>
> ...Stan

Using veryDeepCopy instead of deepCopy would avoid cloning classes
(as the name does not help to guess).

Well, this would deserve some guru advice, I don't much like all these
copy messages... But veryDeepCopy seems much better than deepCopy. The
later is not immune to infinite loops in case of circular references...

Nicolas

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Suspected bug when setting preferences

Nicolas Cellier-3
nice wrote:

> stan shepherd wrote:
>>
>>
>> nicolas cellier wrote:
>>>
>>>
>>> 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
>>>
>>>
>>
>> It happens in Preferences>>savePersonalPreferences
>>     "Save the current list of Preference settings as the user's personal
>> choices"
>>
>>     self  setParameter:#PersonalDictionaryOfPreferences
>>          to:self dictionaryOfPreferences deepCopy
>>
>> I think during the deepCopy.
>>
>> ...Stan
>
> Using veryDeepCopy instead of deepCopy would avoid cloning classes
> (as the name does not help to guess).
>
> Well, this would deserve some guru advice, I don't much like all these
> copy messages... But veryDeepCopy seems much better than deepCopy. The
> later is not immune to infinite loops in case of circular references...
>
> Nicolas

I forgot this, Stan:

You gathered enough material to open a bug report at http://bugs.squeak.org

You should check about deepCopy/Preferences already reported issue, then
create a login an fill a bug form.

Cheers

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Suspected bug when setting preferences

Stan Shepherd

nicolas cellier wrote
I forgot this, Stan:

You gathered enough material to open a bug report at http://bugs.squeak.org

You should check about deepCopy/Preferences already reported issue, then
create a login an fill a bug form.
Reported as 7128. However, I logged it to Squeak-Dev, but in retrospect it should probably be to Squeak itself?
...Stan