Mike Lamb
-
2012-02-03
An object is fetched from a dictionary,
theNode = [repository objectForKey:aName];
if execution enters this if statement,
} else if([theNode isKindOfClass:[NSMutableArray class]]) {
a different object is assigned to the dictionary using the same key as theNode.
[repository setObject:theLogger forKey:aName];
At this point the retainCount of theNode drops to zero, it's released and theNode no longer points to a valid object but it's referenced in the next line,
[self updateChildren:theNode withParent:theLogger ];
On my system, Xcode 4.2.1 targeting iOS 5.0 this causes the application to crash.
The attached patch retains theNode and releases it after it has been referenced.