Reputation: 829
Little confused about the message from Analyze command in Xcode 4.2. It complains about the instance variable activityView.
Analyze tool complains on [self startRefresh:NULL] line about potential leak of activityView.
So, I how should I read the warning from the Analyze tool? Or what changes do I need?
Thx.
Upvotes: 0
Views: 317
Reputation: 17143
Assuming the @property has the retain attribute, the setter will retain this new activity view, so you are still responsible for the +1 count from the alloc/init.
So you can do something like this:
self.activityView = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite] autorelease];
Just autorelease the new instance to balance out the alloc/init.
The analyzer isn't warning you about the previous value of activityView. It's warning you about the new instance, which effectively has a +2 retain count after your alloc/init and the @property (retain).
Upvotes: 2