becomeForward makes corrupted objects

stéphane ducasse ducasse at iam.unibe.ch
Sun Nov 21 18:41:36 UTC 2004


martin I did not check carefully so I may totally wrong but in VW
x become: nil was a documented mistake

x become: String new was suggested. else everything was pointing to nil 
:)

Now the becomeForward: of squeak has different sematnics than the 
become of visualworks and
is equivalent to oneWayBecome:

Stef

On 20 nov. 04, at 13:27, Martin Kuball wrote:

> Am Thursday 18 November 2004 22:54 schrieb Tim Rowledge:
>> Martin Kuball <MartinKuball at web.de> wrote:
>>> After changing all instances of all obsolete classes to nil, some
>>> of those classes are gone. When I try to "nil" the remaining
>>> obsolete classes, the follwoing two
>>>
>>> AnObsoleteAlignmentMorphBob1
>>> AnObsoleteEventMessageSet
>>>
>>> result in a corrupted object memory when I send them a
>>> becomeForward: nil message. Maybe I should not send such a
>>> message to a class object? But than, how do I get rid of these
>>> obsolete classes?
>>
>> It's not good that you get a memory corruption in this case but
>> it's very not-good to try to get rid of objects by any sort of
>> become trickery. Find the objects pointing to them and use an
>> inspector (or even send messages! What a concept :-) to nil out
>> those pointers. The offending unwanted objects will then disappear.
>>
>> If you provide some code to illustrate how the OM gets corrupted we
>> can try to debug it. I recently did soem work on stopping objectA
>> become: objectA crashes and it's conceivable this is related.
>
> Well easy. Take a fresh 3.7 image and open a Workspace. Execute the
> folowing:
>
>  SystemOrganization removeCategoriesMatching: 'Morphic-Experimental'.
>  Smalltalk obsoleteClasses do:
>   [ :c |
>      c allInstancesDo: [ :i | i becomeForward: nil ]
>   ].
>  (Smalltalk obsoleteClasses at: 2) becomeForward: nil.
>
> Now try save+quit the image. It will fail. Or you can do this:
>
>  object := true someObject.
>  [0 == object] whileFalse: [object := object nextObject].
>
> This will trigger the error.
>
> Martin
>
>




More information about the Squeak-dev mailing list