• 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
Cleaning up weak references ( was Re: Odd Crash when adding table columns manually )
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cleaning up weak references ( was Re: Odd Crash when adding table columns manually )


  • Subject: Cleaning up weak references ( was Re: Odd Crash when adding table columns manually )
  • From: Eric Gorr <email@hidden>
  • Date: Thu, 20 Jan 2011 10:22:41 -0500

On Jan 19, 2011, at 8:24 PM, Eric Gorr wrote:

> On Jan 19, 2011, at 8:19 PM, Graham Cox wrote:
>
>> On 20/01/2011, at 12:14 PM, Eric Gorr wrote:
>>
>>> The table is also owned by the the scrolling view and therefore the window and would not be deallocated here...it will stick around long after the controller is deallocated.
>>
>> You're right, but since the table owns its columns, it is still the table's job to manage them, not yours.
>
> Agreed. I never liked the solution, which is one of the reasons why I posted the message to begin with.
>
>> Glad you got it solved anyway, but it's nice to know that the best solution turned out to be the correct, documented and recommended one after all!
>
> Indeed. Learned stuff too...I had not fully understood the rules regarding weak references before.
>
> Hopefully this thread has helped others as well.


I was wondering why this was such a surprise to me, so I went hunting through sample code, books, etc.

I cannot seem to find any sample code, either in books (even Cocoa Programming for Mac OS X (3rd Edition)) or in Apple's own sample code where they follow these rules. I think that is why it has surprised me. I sure there must be some out there that do follow these rules, but the examples seem to be rare at the moment.

For a specific example, check out the AnimatedTableView sample code from Apple.  The ATColorTableController class is a datasource for the table, but it's dealloc looks like:

- (void)dealloc
{
    [_colorList release];
    [_colorNames release];
    [_window release];
    [super dealloc];
}

Based on my current understanding, the dealloc should be setting it's datasource and delegate to nil. Correct? If so, I will file a bug.

Or, what is the reason why the code as written is correct?


_______________________________________________

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: Cleaning up weak references ( was Re: Odd Crash when adding table columns manually )
      • From: Quincey Morris <email@hidden>
    • Re: Cleaning up weak references ( was Re: Odd Crash when adding table columns manually )
      • From: Kyle Sluder <email@hidden>
References: 
 >Odd Crash when adding table columns manually (From: Eric Gorr <email@hidden>)
 >Re: Odd Crash when adding table columns manually (From: Peter Lübke <email@hidden>)
 >Re: Odd Crash when adding table columns manually (From: Eric Gorr <email@hidden>)
 >Re: Odd Crash when adding table columns manually (From: Keary Suska <email@hidden>)
 >Re: Odd Crash when adding table columns manually (From: Eric Gorr <email@hidden>)
 >Re: Odd Crash when adding table columns manually (From: Eric Gorr <email@hidden>)
 >Re: Odd Crash when adding table columns manually (From: Lee Ann Rucker <email@hidden>)
 >Re: Odd Crash when adding table columns manually (From: Eric Gorr <email@hidden>)
 >Re: Odd Crash when adding table columns manually (From: Corbin Dunn <email@hidden>)
 >Re: Odd Crash when adding table columns manually (From: Graham Cox <email@hidden>)
 >Re: Odd Crash when adding table columns manually (From: Eric Gorr <email@hidden>)
 >Re: Odd Crash when adding table columns manually (From: Graham Cox <email@hidden>)
 >Re: Odd Crash when adding table columns manually (From: Eric Gorr <email@hidden>)

  • Prev by Date: Re: printing a different representation than what is on the screen
  • Next by Date: Re: Cleaning up weak references ( was Re: Odd Crash when adding table columns manually )
  • Previous by thread: Re: Odd Crash when adding table columns manually
  • Next by thread: Re: Cleaning up weak references ( was Re: Odd Crash when adding table columns manually )
  • Index(es):
    • Date
    • Thread