• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Crash when closing window from the menu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crash when closing window from the menu


  • Subject: Re: Crash when closing window from the menu
  • From: "Michael Ash" <email@hidden>
  • Date: Mon, 1 Dec 2008 23:59:25 -0500

On Mon, Dec 1, 2008 at 2:54 PM, Jerry Krinock <email@hidden> 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 (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

  • Follow-Ups:
    • Re: Crash when closing window from the menu
      • From: Andre Masse <email@hidden>
References: 
 >Crash when closing window from the menu (From: Andre Masse <email@hidden>)
 >Re: Crash when closing window from the menu (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Crash when closing window from the menu (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: Create command from string
  • Next by Date: Re: Textual representation of an NSData?
  • Previous by thread: Re: Crash when closing window from the menu
  • Next by thread: Re: Crash when closing window from the menu
  • Index(es):
    • Date
    • Thread