Re: Static analyser grumbling
Re: Static analyser grumbling
- Subject: Re: Static analyser grumbling
- From: Kevin Meaney <email@hidden>
- Date: Sat, 24 Aug 2013 10:11:59 +0100
Stupid me.
In the super class context is stored in a var which is the storage for a readonly property and I was assigning to the var in the init method without retaining. So I should be retaining when assigning and doing a release when calling. I don't know where I got the idea parameters passed into the init method would be consumed. Glad that's squashed.
After reading the discussion I was wondering why the analyzer wasn't complaining about the release of the context in the dealloc method of the super class since it wasn't retained on initialization. But I think that is probably asking too much of the static analyzer.
Kevin
On 23 Aug 2013, at 16:42, Kyle Sluder <email@hidden> wrote:
> On Aug 23, 2013, at 4:27 AM, Kevin Meaney <email@hidden> wrote:
>
>>
>> But my feeling is that the analyzer is talking about context. Normally I'd consider that an object passed into an init method will consume a retain count.
>
> Nope. The only consumed refcount is that of the receiver. How is the analyzer supposed to assume what -initWithFoo: does with its argument? Maybe it's a weak pointer, or perhaps it doesn't use the argument at all. The -init convention only applies to the receiver and the return value.
>
> --Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden