Multi Input plugin: Correctly forward register and remove observer callbacks to the actual decoder in use
This commit is contained in:
parent
dfeca7aa97
commit
8d7cd6cc93
1 changed files with 7 additions and 2 deletions
|
@ -126,18 +126,23 @@ NSArray * sortClassesByPriority(NSArray * theClasses)
|
|||
} else {
|
||||
[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 */
|
||||
- (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"]]) {
|
||||
[cachedObservers removeObject:obsItem];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (theDecoder) {
|
||||
[theDecoder removeObserver:observer forKeyPath:keyPath];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue