becomeForward makes corrupted objects

Martin Kuball MartinKuball at web.de
Sat Nov 20 12:27:19 UTC 2004


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