[Pharo-project] Issue 3957 in pharo: MethodWrappers left method after uninstall

pharo at googlecode.com pharo at googlecode.com
Mon Apr 4 19:20:25 CEST 2011


Status: New
Owner: ----

New issue 3957 by lem... at gmail.com: MethodWrappers left method after  
uninstall
http://code.google.com/p/pharo/issues/detail?id=3957

Pharo image: Pharo 1.2.1 Latest update: #12345
Virtual machine used:  'Croquet Closure Stack VM [StackInterpreter  
VMMaker-oscog-IgorStasenko.54]'
Class browser used (if applicable): OB
Steps to reproduce:
1. create a new class, example Foo
2. install a method wrapper on Foo, on a selector non defined locally.
3. uninstall the method wrapper.
4. now you have the method defined locally, with the inherited behavior.
Example:
| a |
a := ObjectAsMethodWrapper on: Foo selector: #hash.
a install.
a uninstall.

Now you have a hash method on Foo, that should not be there.
One solution is to add something like this to the install code:
(self wrappedClass localSelectors includes: self selector)
		ifTrue: [needCleanUp := false.]
		ifFalse: [needCleanUp := true].

And this to the uninstall code:
needCleanUp ifTrue: [self wrappedClass removeSelector: self selector]





More information about the Pharo-project mailing list