Skip to content

Commit

Permalink
Retain class observers
Browse files Browse the repository at this point in the history
  • Loading branch information
zintus committed Nov 13, 2015
1 parent 2182390 commit 52d374c
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ - (void)addObserver:(id<SFInjectionObserver>)observer forClass:(Class)aClass {
return;
}
@synchronized (_observers) {
NSMutableSet * observersPerClass = [_observers objectForKey:aClass];
CFMutableSetRef observersPerClass = (__bridge CFMutableSetRef)([_observers objectForKey:aClass]);
if (!observersPerClass) {
observersPerClass = (__bridge_transfer NSMutableSet *) CFSetCreateMutable(nil, 0, nil);
[_observers setObject:observersPerClass forKey:aClass];
observersPerClass = CFSetCreateMutable(nil, 0, nil);
[_observers setObject:(__bridge_transfer NSMutableSet *) observersPerClass forKey:aClass];
}
@synchronized (observersPerClass) {
[observersPerClass addObject:observer];
@synchronized ((__bridge id)observersPerClass) {
CFSetSetValue(observersPerClass, (__bridge_retained void*) observer);
}
}
}
Expand Down

0 comments on commit 52d374c

Please sign in to comment.