• 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: Outline View not retaining objects it uses. Why?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Outline View not retaining objects it uses. Why?


  • Subject: Re: Outline View not retaining objects it uses. Why?
  • From: Paul Sargent <email@hidden>
  • Date: Sun, 20 Jul 2008 01:52:22 +0100


On 19 Jul 2008, at 23:18, Quincey Morris wrote:

On Jul 19, 2008, at 14:35, Paul Sargent wrote:

This works fine the first time the view is populated, but when it's refreshed it just calls the second method with the pointers to the dictionaries I return first time round. Trouble is they've been autoreleased by now.

I think you mean "deallocated", not "autoreleased". The question is, what's your evidence that they're deallocated? Is something crashing?

Just to be clear, I mean the object was de-allocated due to it being an object created by a convenience method, and the auto release pool it was in was released when control went back to the event loop.


Yes, when the OutlineView redraws for some reason (e.g. a mouse click), it re-accesses the objects I returned last time (nothing wrong with that). Trouble is, they are no longer valid, resulting in a crash or a zombie log message if I have zombies enabled. I was just surprised by the fact the OutlineView held pointers to objects it didn't retain.

The main thing that's wrong here is that you're returning a *different* object from outlineView:child:ofItem: each time. You should return the same object if you are given the same parameters. If finding extraInfo is not incredibly expensive, you could just return aDataItem in the first method, and find extraInfo in the second.

While you're right I would return different objects if I was called twice, I'm not. As I understand it the Outline View will only ask for objects when it knows the data has changed (e.g. after a reloadData or reloadItem call) at which point it needs to expect a different object.


It's exactly the cost that took me down the road of bundling the info up into a dictionary, so any other call backs didn't need to re- evaluate things. Obviously I wasn't expecting anybody to guess that from the code I posted.


_______________________________________________

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: Outline View not retaining objects it uses. Why?
      • From: Ken Thomases <email@hidden>
References: 
 >Outline View not retaining objects it uses. Why? (From: Paul Sargent <email@hidden>)
 >Re: Outline View not retaining objects it uses. Why? (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: NSNumber Formatter with percent?
  • Next by Date: Re: Outline View not retaining objects it uses. Why?
  • Previous by thread: Re: Outline View not retaining objects it uses. Why?
  • Next by thread: Re: Outline View not retaining objects it uses. Why?
  • Index(es):
    • Date
    • Thread