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

2011-01-20 Thread Andy Lee
On Jan 20, 2011, at 9:39 PM, Corbin Dunn wrote: > Now for something like a button, it obviously won't run into this type of > latent drawing issue, since they don't message the delegate every time they > draw. However, if you temporarily allocated an object and set it as the > target/action of a

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

2011-01-20 Thread Andy Lee
On Jan 20, 2011, at 8:51 PM, Eric Gorr wrote: > On Jan 20, 2011, at 4:27 PM, Corbin Dunn wrote: [...] >> Yes, please do file a bug. The sample should set the delegate/datasource to >> nil, as it is good practice to do so, and we can update the sample. > > Bug filed: rdar://8896270 I just submit

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

2011-01-20 Thread Corbin Dunn
On Jan 20, 2011, at 1:33 PM, Abdul Sowayan wrote: > Hi Corbin, > > >> I wrote that sample, and gave the WWDC talk based on it a few years ago. I >> also "own" NSTableView. >> >> Yes, please do file a bug. The sample should set the delegate/datasource to >> nil, as it is good practice to do so,

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

2011-01-20 Thread Eric Gorr
On Jan 20, 2011, at 4:27 PM, Corbin Dunn wrote: > Hi Eric, > > On Jan 20, 2011, at 9:26 AM, Eric Gorr wrote: > >> >> On Jan 20, 2011, at 12:17 PM, Kyle Sluder wrote: >> >>> On Thu, Jan 20, 2011 at 7:22 AM, Eric Gorr wrote: Based on my current understanding, the dealloc should be setting

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

2011-01-20 Thread Eric Gorr
On Jan 20, 2011, at 4:56 PM, Sean McBride wrote: > On Thu, 20 Jan 2011 13:27:35 -0800, Corbin Dunn said: > >>> 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: >>>

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

2011-01-20 Thread Sean McBride
On Thu, 20 Jan 2011 13:27:35 -0800, Corbin Dunn said: >> 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]; >> [_colo

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

2011-01-20 Thread Abdul Sowayan
Hi Corbin, > I wrote that sample, and gave the WWDC talk based on it a few years ago. I > also "own" NSTableView. > > Yes, please do file a bug. The sample should set the delegate/datasource to > nil, as it is good practice to do so, and we can update the sample. Thanks for the clarification, i

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

2011-01-20 Thread Corbin Dunn
Hi Eric, On Jan 20, 2011, at 9:26 AM, Eric Gorr wrote: > > On Jan 20, 2011, at 12:17 PM, Kyle Sluder wrote: > >> On Thu, Jan 20, 2011 at 7:22 AM, Eric Gorr wrote: >>> Based on my current understanding, the dealloc should be setting it's >>> datasource and delegate to nil. Correct? If so, I wi

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

2011-01-20 Thread Abdul Sowayan
Hi folks, I'm trying to figure out a clear guideline on how to handle weak references. Let's consider the following scenarios: 1- Say I have a button, and set its action/target (via a nib file) to call method on the controller. In the controller dealloc method, should the controller set the actio

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

2011-01-20 Thread Quincey Morris
On Jan 20, 2011, at 07:22, Eric Gorr wrote: > 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 w

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

2011-01-20 Thread Eric Gorr
On Jan 20, 2011, at 12:17 PM, Kyle Sluder wrote: > On Thu, Jan 20, 2011 at 7:22 AM, Eric Gorr wrote: >> 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. > > No. It is the responsibility of the delegate t

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

2011-01-20 Thread Kyle Sluder
On Thu, Jan 20, 2011 at 7:22 AM, Eric Gorr wrote: > 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. No. It is the responsibility of the delegate to set the table view's backpointer to nil. The delegate usu

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

2011-01-20 Thread Eric Gorr
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 af