- (void) didChangeValueForKey: (NSString*)aKey
{
GSKVOPathInfo *pathInfo;
GSKVOInfo *info;
info = (GSKVOInfo *)[self observationInfo];
if (info == nil)
{
return;
}
pathInfo = [info lockReturningPathInfoForKey: aKey];
if (pathInfo != nil)
{
[pathInfo retain]; //!!fixes the crash
if (pathInfo->recursion == 1)
{
id value = [self valueForKey: aKey];
if (value == nil)
{
value = null;
}
[pathInfo->change setValue: value
forKey: NSKeyValueChangeNewKey];
[pathInfo->change setValue:
[NSNumber numberWithInt: NSKeyValueChangeSetting]
forKey: NSKeyValueChangeKindKey];
[pathInfo notifyForKey: aKey ofInstance: [info instance] prior: NO];
// here pathInfo may get destroyed if removeObserver is called
}
if (pathInfo->recursion > 0)
{
pathInfo->recursion--;
}
[info unlock];
[pathInfo release]; //!!fixes the crash
}
[self didChangeValueForDependentsOfKey: aKey];
}