Ah ok.... So you should look at what Pablo did because he is handling this case for code update, the idea is that he will put on the stack a kind of notifier so that you get aware when the m is not on the stack anymore.
Stef On Mon, Sep 25, 2017 at 6:05 PM, Steven Costiou <steven.cost...@kloum.io> wrote: > Le 2017-09-25 17:47, Stephane Ducasse a écrit : > > This is exactly my usecase, i need to remove code that may be called > by a method on the stack - and i know exactly which method. However my > base hypothesis is that it is in an already running process (maybe a > loop) and that part i cannot change. Is there an existing Pharo > implementation of MethodWrappers ? > > How can you remove a method if it may be called? > > Stef > > Lets say i have the following method: > > m > > ^self m1 > > I have dynamically changed the code of m for a specific object o by the > following: > > m > > self m2. > > ^self m1 > > m2 is behavior that is dynamically added to the object o. > > If i want to revert the object o to its original behavior, that will change > back m and remove m2, i must be sure that the changed m is not on the stack, > else it could still call m2 that no longer exists. > > Actually i tried Ben's suggestion, and it works. I just ask the process to > run until the method i target is popped out of the stack and then i can > remoev my code. > > Steven.