On Mon, Dec 1, 2008 at 2:54 PM, Jerry Krinock <[EMAIL PROTECTED]> wrote:
>
> On 2008 Dec, 01, at 6:12, Jean-Daniel Dupas wrote:
>
>> - (void)dealloc {
>>        [_tableView setDataSource:nil];
>>        [_otherIVar setDelegate:nil];
>
> According to [1], you need one more line of code here:
>          [tableView reloadData];

That document describes the scenario where you destroy your data
objects, not where you destroy the data source yourself. The call to
setDataSource: is sufficient, as it can no longer query you after that
point.

In general, you always need to clear any weak references to your
objects when they are deallocated. This is most well known for the
weak references you get from NSNotificationCenter, but it applies to
other weak references such as delegate and data source references as
well. For those you can often get away with not clearing them if they
end up getting deallocated at the same time, but as people are
discovering here, in some situations you can't count on that.

Mike
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to