On Jul 22, 2009, at 10:41 PM, Alexander Bokovikov <openwo...@uralweb.ru> wrote:
where it is said, among other, that NSTableView items may be filled out like this:

Tables aren't actually filled with anything. Instead, you provide the table with a data source object that fulfills the table's data needs upon request.

getString(rowIndex, buf, &len);
return [NSString stringWithCString:buf length:len encoding:NSUTF8StringEncoding];

Be aware that this method needs to be *fast*. This might mean caching your values as they are generated, if possible.

I.e. is it possible to return a NSString without its preliminary retaining?

Re-read the Cocoa memory management guide. +stringWithCString:encoding: does not start with allocate or copy, meaning you don't own it. Therefore you must not release it. Likewise, the method you're implementing doesn't start with allocate or copy, so you must not leak ownership of the returned object.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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

This email sent to arch...@mail-archive.com

Reply via email to