From 788606f424d6a99bc2de5dfdfb00ecaab9329313 Mon Sep 17 00:00:00 2001 From: Gregory Casamento Date: Fri, 15 Sep 2023 14:59:33 -0400 Subject: [PATCH] Add method which calls info implementation --- Source/NSKeyValueObserving.m | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Source/NSKeyValueObserving.m b/Source/NSKeyValueObserving.m index 5055daa39..406d6a705 100644 --- a/Source/NSKeyValueObserving.m +++ b/Source/NSKeyValueObserving.m @@ -1605,6 +1605,31 @@ cifframe_callback(ffi_cif *cif, void *retp, void **args, void *user) [forwarder finalize]; } +- (void) removeObserver: (NSObject*)anObserver + forKeyPath: (NSString*)aPath + context: (void *)context +{ + GSKVOInfo *info; + + setup(); + [kvoLock lock]; + /* + * Get the observation information and remove this observation. + */ + info = (GSKVOInfo*)[self observationInfo]; + [info removeObserver: anObserver forKeyPath: aPath context: context]; + if ([info isUnobserved] == YES) + { + /* + * The instance is no longer being observed ... so we can + * turn off key-value-observing for it. + */ + object_setClass(self, [self class]); + IF_NO_GC(AUTORELEASE(info);) + [self setObservationInfo: nil]; + } + [kvoLock unlock]; +} @end