Consider the following example properties:

    NSApplication: @property(strong) NSMenu *mainMenu
    NSFont: @property(readonly, copy) NSString *familyName
    NSColorPanel: @property(copy) NSColor *color

AFAIU I must not release the NSMenu/NSString/NSColor obtained from these
properties because I don't own the objects returned by those properties and
Apple's memory management policy docs clearly say:

    "You must not relinquish ownership of an object you do not own"

So I think I've got that right but I'd be glad if somebody could just
confirm that I got it right ;)

I'm just a little confused because of the keywords "strong" and "copy" in
the @property declarations but AFAIU these only refer to setting those
properties, not getting those properties, i.e. the object is copied when
*setting* the property, not when *getting* it. Right?

And another question: Can it also happen that a class has a property
which returns an object which I *must* release or is it a general rule
that getting a @property always returns objects which I do not own
and hence mustn't released?

Thanks!

-- 
Best regards,
 Andreas Falkenhahn                          mailto:[email protected]

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to