Hmmm, we can't easily replace the hook, but remove the code block so nothing will be called extra.

cheers,
Peter

> On 07.05.2014, at 16:10, Ash Furrow <notifications@github.com> wrote:
> 
> In Aspects.m:
> 
> > @@ -65,7 +71,27 @@ @implementation NSObject (Aspects)
> >                        withOptions:(AspectOptions)options
> >                         usingBlock:(AspectBlock)block
> >                              error:(NSError **)error {
> > -    return aspect_add((id)self, selector, options, block, error);
> > +    
> > +    static void *AllocKey = &AllocKey;
> > +    id token = objc_getAssociatedObject(self, AllocKey);
> > +    
> > +    if (!token) {
> > +        objc_setAssociatedObject(self, AllocKey, [NSObject new], OBJC_ASSOCIATION_RETAIN);
> > +        aspects_swizzleAlloc(self);
> > +    }
> > +    
> > +    __block AspectIdentifier *identifier = nil;
> > +    aspect_performLocked(^{
> > +        if (aspect_isSelectorAllowedAndTrack((id)self, selector, options, error)) {
> > +            AspectsContainer *aspectContainer = aspect_getContainerForObject((id)self, selector);
> > +            identifier = [[AspectIdentifier alloc] initWithSelector:selector object:self options:options block:block];
> I understand that there's only one AspectClassContainer per class, but here's my question: after creating a hook on a class, creating an instance of that class, and then removing that hook, the instance of the class still has the hook embedded in it. How do we get it to be removed when the class container's hook are removed?
> 
> —
> Reply to this email directly or view it on GitHub.