Zephyr icon indicating copy to clipboard operation
Zephyr copied to clipboard

Leaks SBOffscreenSwipeGestureRecognizer

Open rpetrich opened this issue 13 years ago • 0 comments

Every time a touch begins, two new SBOffscreenSwipeGestureRecognizer are allocated. I used this code to make SBGestureRecognizer.activeRecognizers work in cycript:

static CFMutableSetRef activeRecognizers;

%hook SBGestureRecognizer

%new
+ (NSSet *)activeRecognizers
{
    return (NSSet *)activeRecognizers;
}

- (id)init
{
    if ((self = %orig)) {
        if (!activeRecognizers)
            activeRecognizers = CFSetCreateMutable(NULL, 0, NULL);
        CFSetAddValue(activeRecognizers, self);
    }
    return self;
}

- (void)dealloc
{
    CFSetRemoveValue(activeRecognizers, self);
    %orig;
}

%end

rpetrich avatar Dec 29 '11 12:12 rpetrich