chpwn/Spire — Issue #1: Leaks SBOffscreenSwipeGestureRecognizer
Author: rpetrich
Created: 2011-12-29 12:17:28+00:00
State: open

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

```objc
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
```