Multi Input plugin: Correctly forward register and remove observer callbacks to the actual decoder in use
parent
dfeca7aa97
commit
8d7cd6cc93
|
@ -126,18 +126,23 @@ NSArray * sortClassesByPriority(NSArray * theClasses)
|
||||||
} else {
|
} else {
|
||||||
[cachedObservers addObject:[NSDictionary dictionaryWithObjectsAndKeys:observer, @"observer", keyPath, @"keyPath", @(options), @"options", nil]];
|
[cachedObservers addObject:[NSDictionary dictionaryWithObjectsAndKeys:observer, @"observer", keyPath, @"keyPath", @(options), @"options", nil]];
|
||||||
}
|
}
|
||||||
|
if (theDecoder) {
|
||||||
|
[theDecoder addObserver:observer forKeyPath:keyPath options:options context:context];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* And this is currently called after the decoder is closed */
|
/* And this is currently called after the decoder is closed */
|
||||||
- (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath
|
- (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath
|
||||||
{
|
{
|
||||||
for (NSDictionary *obsItem in cachedObservers)
|
for (NSDictionary *obsItem in cachedObservers) {
|
||||||
{
|
|
||||||
if ([obsItem objectForKey:@"observer"] == observer && [keyPath isEqualToString:[obsItem objectForKey:@"keyPath"]]) {
|
if ([obsItem objectForKey:@"observer"] == observer && [keyPath isEqualToString:[obsItem objectForKey:@"keyPath"]]) {
|
||||||
[cachedObservers removeObject:obsItem];
|
[cachedObservers removeObject:obsItem];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (theDecoder) {
|
||||||
|
[theDecoder removeObserver:observer forKeyPath:keyPath];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in New Issue